stackit-telemetryrouter 0.1.0__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 (42) hide show
  1. src/stackit/telemetryrouter/__init__.py +151 -0
  2. src/stackit/telemetryrouter/api/__init__.py +4 -0
  3. src/stackit/telemetryrouter/api/default_api.py +4511 -0
  4. src/stackit/telemetryrouter/api_client.py +652 -0
  5. src/stackit/telemetryrouter/api_response.py +23 -0
  6. src/stackit/telemetryrouter/configuration.py +163 -0
  7. src/stackit/telemetryrouter/exceptions.py +217 -0
  8. src/stackit/telemetryrouter/models/__init__.py +80 -0
  9. src/stackit/telemetryrouter/models/access_token_base_request.py +105 -0
  10. src/stackit/telemetryrouter/models/access_token_base_response.py +138 -0
  11. src/stackit/telemetryrouter/models/config_filter.py +100 -0
  12. src/stackit/telemetryrouter/models/config_filter_attributes.py +96 -0
  13. src/stackit/telemetryrouter/models/config_filter_level.py +37 -0
  14. src/stackit/telemetryrouter/models/config_filter_matcher.py +36 -0
  15. src/stackit/telemetryrouter/models/create_access_token_payload.py +105 -0
  16. src/stackit/telemetryrouter/models/create_access_token_response.py +148 -0
  17. src/stackit/telemetryrouter/models/create_destination_payload.py +107 -0
  18. src/stackit/telemetryrouter/models/create_telemetry_router_payload.py +107 -0
  19. src/stackit/telemetryrouter/models/destination_config.py +111 -0
  20. src/stackit/telemetryrouter/models/destination_config_open_telemetry.py +102 -0
  21. src/stackit/telemetryrouter/models/destination_config_open_telemetry_basic_auth.py +82 -0
  22. src/stackit/telemetryrouter/models/destination_config_s3.py +102 -0
  23. src/stackit/telemetryrouter/models/destination_config_s3_access_key.py +82 -0
  24. src/stackit/telemetryrouter/models/destination_config_type.py +36 -0
  25. src/stackit/telemetryrouter/models/destination_response.py +152 -0
  26. src/stackit/telemetryrouter/models/get_access_token_response.py +138 -0
  27. src/stackit/telemetryrouter/models/list_access_tokens_response.py +104 -0
  28. src/stackit/telemetryrouter/models/list_destinations_response.py +102 -0
  29. src/stackit/telemetryrouter/models/list_telemetry_routers_response.py +104 -0
  30. src/stackit/telemetryrouter/models/response4xx.py +81 -0
  31. src/stackit/telemetryrouter/models/telemetry_router_response.py +137 -0
  32. src/stackit/telemetryrouter/models/update_access_token_payload.py +105 -0
  33. src/stackit/telemetryrouter/models/update_access_token_response.py +138 -0
  34. src/stackit/telemetryrouter/models/update_destination_payload.py +112 -0
  35. src/stackit/telemetryrouter/models/update_telemetry_router_payload.py +112 -0
  36. src/stackit/telemetryrouter/py.typed +0 -0
  37. src/stackit/telemetryrouter/rest.py +164 -0
  38. stackit_telemetryrouter-0.1.0.dist-info/METADATA +48 -0
  39. stackit_telemetryrouter-0.1.0.dist-info/RECORD +42 -0
  40. stackit_telemetryrouter-0.1.0.dist-info/WHEEL +4 -0
  41. stackit_telemetryrouter-0.1.0.dist-info/licenses/LICENSE.md +201 -0
  42. stackit_telemetryrouter-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
@@ -0,0 +1,81 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Router API
5
+
6
+ This API provides endpoints for managing Telemetry Routers.
7
+
8
+ The version of the OpenAPI document: 1beta.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing_extensions import Self
22
+
23
+
24
+ class Response4xx(BaseModel):
25
+ """
26
+ Response4xx
27
+ """ # noqa: E501
28
+
29
+ message: StrictStr = Field(description="A message containing the reason for failure")
30
+ __properties: ClassVar[List[str]] = ["message"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+ def to_str(self) -> str:
39
+ """Returns the string representation of the model using alias"""
40
+ return pprint.pformat(self.model_dump(by_alias=True))
41
+
42
+ def to_json(self) -> str:
43
+ """Returns the JSON representation of the model using alias"""
44
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
45
+ return json.dumps(self.to_dict())
46
+
47
+ @classmethod
48
+ def from_json(cls, json_str: str) -> Optional[Self]:
49
+ """Create an instance of Response4xx from a JSON string"""
50
+ return cls.from_dict(json.loads(json_str))
51
+
52
+ def to_dict(self) -> Dict[str, Any]:
53
+ """Return the dictionary representation of the model using alias.
54
+
55
+ This has the following differences from calling pydantic's
56
+ `self.model_dump(by_alias=True)`:
57
+
58
+ * `None` is only added to the output dict for nullable fields that
59
+ were set at model initialization. Other fields with value `None`
60
+ are ignored.
61
+ """
62
+ excluded_fields: Set[str] = set([])
63
+
64
+ _dict = self.model_dump(
65
+ by_alias=True,
66
+ exclude=excluded_fields,
67
+ exclude_none=True,
68
+ )
69
+ return _dict
70
+
71
+ @classmethod
72
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
73
+ """Create an instance of Response4xx from a dict"""
74
+ if obj is None:
75
+ return None
76
+
77
+ if not isinstance(obj, dict):
78
+ return cls.model_validate(obj)
79
+
80
+ _obj = cls.model_validate({"message": obj.get("message")})
81
+ return _obj
@@ -0,0 +1,137 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Router API
5
+
6
+ This API provides endpoints for managing Telemetry Routers.
7
+
8
+ The version of the OpenAPI document: 1beta.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from datetime import datetime
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+ from uuid import UUID
22
+
23
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from typing_extensions import Annotated, Self
25
+
26
+ from stackit.telemetryrouter.models.config_filter import ConfigFilter
27
+
28
+
29
+ class TelemetryRouterResponse(BaseModel):
30
+ """
31
+ TelemetryRouterResponse
32
+ """ # noqa: E501
33
+
34
+ creation_time: datetime = Field(description="The point in time the resource was created.", alias="creationTime")
35
+ description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
36
+ default=None,
37
+ description="The description is a longer text chosen by the user to provide more context for the resource.",
38
+ )
39
+ display_name: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field(
40
+ description="The display name is a short name chosen by the user to identify the resource.", alias="displayName"
41
+ )
42
+ filter: Optional[ConfigFilter] = None
43
+ id: UUID = Field(description="A auto generated unique id which identifies the resource.")
44
+ status: StrictStr = Field(description="The current status of the resource.")
45
+ uri: Annotated[str, Field(strict=True, max_length=1024)] = Field(description="The URI for reaching the resource.")
46
+ __properties: ClassVar[List[str]] = ["creationTime", "description", "displayName", "filter", "id", "status", "uri"]
47
+
48
+ @field_validator("creation_time", mode="before")
49
+ def creation_time_change_year_zero_to_one(cls, value):
50
+ """Workaround which prevents year 0 issue"""
51
+ if isinstance(value, str):
52
+ # Check for year "0000" at the beginning of the string
53
+ # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
54
+ if value.startswith("0000-01-01T") and re.match(
55
+ r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
56
+ ):
57
+ # Workaround: Replace "0000" with "0001"
58
+ return "0001" + value[4:] # Take "0001" and append the rest of the string
59
+ return value
60
+
61
+ @field_validator("display_name")
62
+ def display_name_validate_regular_expression(cls, value):
63
+ """Validates the regular expression"""
64
+ if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 \-]*$", value):
65
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 \-]*$/")
66
+ return value
67
+
68
+ @field_validator("status")
69
+ def status_validate_enum(cls, value):
70
+ """Validates the enum"""
71
+ if value not in set(["reconciling", "active", "deleting"]):
72
+ raise ValueError("must be one of enum values ('reconciling', 'active', 'deleting')")
73
+ return value
74
+
75
+ model_config = ConfigDict(
76
+ populate_by_name=True,
77
+ validate_assignment=True,
78
+ protected_namespaces=(),
79
+ )
80
+
81
+ def to_str(self) -> str:
82
+ """Returns the string representation of the model using alias"""
83
+ return pprint.pformat(self.model_dump(by_alias=True))
84
+
85
+ def to_json(self) -> str:
86
+ """Returns the JSON representation of the model using alias"""
87
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
88
+ return json.dumps(self.to_dict())
89
+
90
+ @classmethod
91
+ def from_json(cls, json_str: str) -> Optional[Self]:
92
+ """Create an instance of TelemetryRouterResponse from a JSON string"""
93
+ return cls.from_dict(json.loads(json_str))
94
+
95
+ def to_dict(self) -> Dict[str, Any]:
96
+ """Return the dictionary representation of the model using alias.
97
+
98
+ This has the following differences from calling pydantic's
99
+ `self.model_dump(by_alias=True)`:
100
+
101
+ * `None` is only added to the output dict for nullable fields that
102
+ were set at model initialization. Other fields with value `None`
103
+ are ignored.
104
+ """
105
+ excluded_fields: Set[str] = set([])
106
+
107
+ _dict = self.model_dump(
108
+ by_alias=True,
109
+ exclude=excluded_fields,
110
+ exclude_none=True,
111
+ )
112
+ # override the default output from pydantic by calling `to_dict()` of filter
113
+ if self.filter:
114
+ _dict["filter"] = self.filter.to_dict()
115
+ return _dict
116
+
117
+ @classmethod
118
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
119
+ """Create an instance of TelemetryRouterResponse from a dict"""
120
+ if obj is None:
121
+ return None
122
+
123
+ if not isinstance(obj, dict):
124
+ return cls.model_validate(obj)
125
+
126
+ _obj = cls.model_validate(
127
+ {
128
+ "creationTime": obj.get("creationTime"),
129
+ "description": obj.get("description"),
130
+ "displayName": obj.get("displayName"),
131
+ "filter": ConfigFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None,
132
+ "id": obj.get("id"),
133
+ "status": obj.get("status"),
134
+ "uri": obj.get("uri"),
135
+ }
136
+ )
137
+ return _obj
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Router API
5
+
6
+ This API provides endpoints for managing Telemetry Routers.
7
+
8
+ The version of the OpenAPI document: 1beta.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+
25
+ class UpdateAccessTokenPayload(BaseModel):
26
+ """
27
+ UpdateAccessTokenPayload
28
+ """ # noqa: E501
29
+
30
+ description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = None
31
+ display_name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=32)]] = Field(
32
+ default=None, alias="displayName"
33
+ )
34
+ __properties: ClassVar[List[str]] = ["description", "displayName"]
35
+
36
+ @field_validator("display_name")
37
+ def display_name_validate_regular_expression(cls, value):
38
+ """Validates the regular expression"""
39
+ if value is None:
40
+ return value
41
+
42
+ if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 \-]*$", value):
43
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 \-]*$/")
44
+ return value
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of UpdateAccessTokenPayload from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ # set to None if description (nullable) is None
84
+ # and model_fields_set contains the field
85
+ if self.description is None and "description" in self.model_fields_set:
86
+ _dict["description"] = None
87
+
88
+ # set to None if display_name (nullable) is None
89
+ # and model_fields_set contains the field
90
+ if self.display_name is None and "display_name" in self.model_fields_set:
91
+ _dict["displayName"] = None
92
+
93
+ return _dict
94
+
95
+ @classmethod
96
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
+ """Create an instance of UpdateAccessTokenPayload from a dict"""
98
+ if obj is None:
99
+ return None
100
+
101
+ if not isinstance(obj, dict):
102
+ return cls.model_validate(obj)
103
+
104
+ _obj = cls.model_validate({"description": obj.get("description"), "displayName": obj.get("displayName")})
105
+ return _obj
@@ -0,0 +1,138 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Router API
5
+
6
+ This API provides endpoints for managing Telemetry Routers.
7
+
8
+ The version of the OpenAPI document: 1beta.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from datetime import datetime
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+ from uuid import UUID
22
+
23
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from typing_extensions import Annotated, Self
25
+
26
+
27
+ class UpdateAccessTokenResponse(BaseModel):
28
+ """
29
+ UpdateAccessTokenResponse
30
+ """ # noqa: E501
31
+
32
+ creator_id: StrictStr = Field(description="The user ID of the creator of the access token.", alias="creatorId")
33
+ description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
34
+ default=None, description="The description of the access token."
35
+ )
36
+ display_name: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field(
37
+ description="The selected display name of the access token.", alias="displayName"
38
+ )
39
+ expiration_time: Optional[datetime] = Field(
40
+ default=None,
41
+ description="The date and time until the access token is valid to (inclusively).",
42
+ alias="expirationTime",
43
+ )
44
+ id: UUID = Field(description="An auto generated unique id which identifies the access token.")
45
+ status: StrictStr
46
+ __properties: ClassVar[List[str]] = ["creatorId", "description", "displayName", "expirationTime", "id", "status"]
47
+
48
+ @field_validator("display_name")
49
+ def display_name_validate_regular_expression(cls, value):
50
+ """Validates the regular expression"""
51
+ if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 ]*$", value):
52
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 ]*$/")
53
+ return value
54
+
55
+ @field_validator("expiration_time", mode="before")
56
+ def expiration_time_change_year_zero_to_one(cls, value):
57
+ """Workaround which prevents year 0 issue"""
58
+ if isinstance(value, str):
59
+ # Check for year "0000" at the beginning of the string
60
+ # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
61
+ if value.startswith("0000-01-01T") and re.match(
62
+ r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
63
+ ):
64
+ # Workaround: Replace "0000" with "0001"
65
+ return "0001" + value[4:] # Take "0001" and append the rest of the string
66
+ return value
67
+
68
+ @field_validator("status")
69
+ def status_validate_enum(cls, value):
70
+ """Validates the enum"""
71
+ if value not in set(["active", "expired", "deleting"]):
72
+ raise ValueError("must be one of enum values ('active', 'expired', 'deleting')")
73
+ return value
74
+
75
+ model_config = ConfigDict(
76
+ populate_by_name=True,
77
+ validate_assignment=True,
78
+ protected_namespaces=(),
79
+ )
80
+
81
+ def to_str(self) -> str:
82
+ """Returns the string representation of the model using alias"""
83
+ return pprint.pformat(self.model_dump(by_alias=True))
84
+
85
+ def to_json(self) -> str:
86
+ """Returns the JSON representation of the model using alias"""
87
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
88
+ return json.dumps(self.to_dict())
89
+
90
+ @classmethod
91
+ def from_json(cls, json_str: str) -> Optional[Self]:
92
+ """Create an instance of UpdateAccessTokenResponse from a JSON string"""
93
+ return cls.from_dict(json.loads(json_str))
94
+
95
+ def to_dict(self) -> Dict[str, Any]:
96
+ """Return the dictionary representation of the model using alias.
97
+
98
+ This has the following differences from calling pydantic's
99
+ `self.model_dump(by_alias=True)`:
100
+
101
+ * `None` is only added to the output dict for nullable fields that
102
+ were set at model initialization. Other fields with value `None`
103
+ are ignored.
104
+ """
105
+ excluded_fields: Set[str] = set([])
106
+
107
+ _dict = self.model_dump(
108
+ by_alias=True,
109
+ exclude=excluded_fields,
110
+ exclude_none=True,
111
+ )
112
+ # set to None if expiration_time (nullable) is None
113
+ # and model_fields_set contains the field
114
+ if self.expiration_time is None and "expiration_time" in self.model_fields_set:
115
+ _dict["expirationTime"] = None
116
+
117
+ return _dict
118
+
119
+ @classmethod
120
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
121
+ """Create an instance of UpdateAccessTokenResponse from a dict"""
122
+ if obj is None:
123
+ return None
124
+
125
+ if not isinstance(obj, dict):
126
+ return cls.model_validate(obj)
127
+
128
+ _obj = cls.model_validate(
129
+ {
130
+ "creatorId": obj.get("creatorId"),
131
+ "description": obj.get("description"),
132
+ "displayName": obj.get("displayName"),
133
+ "expirationTime": obj.get("expirationTime"),
134
+ "id": obj.get("id"),
135
+ "status": obj.get("status"),
136
+ }
137
+ )
138
+ return _obj
@@ -0,0 +1,112 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Router API
5
+
6
+ This API provides endpoints for managing Telemetry Routers.
7
+
8
+ The version of the OpenAPI document: 1beta.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+ from stackit.telemetryrouter.models.destination_config import DestinationConfig
25
+
26
+
27
+ class UpdateDestinationPayload(BaseModel):
28
+ """
29
+ UpdateDestinationPayload
30
+ """ # noqa: E501
31
+
32
+ config: Optional[DestinationConfig] = None
33
+ description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
34
+ default=None,
35
+ description="The description is a longer text chosen by the user to provide more context for the resource.",
36
+ )
37
+ display_name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=32)]] = Field(
38
+ default=None,
39
+ description="The display name is a short name chosen by the user to identify the resource.",
40
+ alias="displayName",
41
+ )
42
+ __properties: ClassVar[List[str]] = ["config", "description", "displayName"]
43
+
44
+ @field_validator("display_name")
45
+ def display_name_validate_regular_expression(cls, value):
46
+ """Validates the regular expression"""
47
+ if value is None:
48
+ return value
49
+
50
+ if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 \-]*$", value):
51
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 \-]*$/")
52
+ return value
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+ def to_str(self) -> str:
61
+ """Returns the string representation of the model using alias"""
62
+ return pprint.pformat(self.model_dump(by_alias=True))
63
+
64
+ def to_json(self) -> str:
65
+ """Returns the JSON representation of the model using alias"""
66
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
+ return json.dumps(self.to_dict())
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of UpdateDestinationPayload from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # override the default output from pydantic by calling `to_dict()` of config
92
+ if self.config:
93
+ _dict["config"] = self.config.to_dict()
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of UpdateDestinationPayload from a dict"""
99
+ if obj is None:
100
+ return None
101
+
102
+ if not isinstance(obj, dict):
103
+ return cls.model_validate(obj)
104
+
105
+ _obj = cls.model_validate(
106
+ {
107
+ "config": DestinationConfig.from_dict(obj["config"]) if obj.get("config") is not None else None,
108
+ "description": obj.get("description"),
109
+ "displayName": obj.get("displayName"),
110
+ }
111
+ )
112
+ return _obj
@@ -0,0 +1,112 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Router API
5
+
6
+ This API provides endpoints for managing Telemetry Routers.
7
+
8
+ The version of the OpenAPI document: 1beta.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+ from stackit.telemetryrouter.models.config_filter import ConfigFilter
25
+
26
+
27
+ class UpdateTelemetryRouterPayload(BaseModel):
28
+ """
29
+ UpdateTelemetryRouterPayload
30
+ """ # noqa: E501
31
+
32
+ description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
33
+ default=None,
34
+ description="The description is a longer text chosen by the user to provide more context for the resource.",
35
+ )
36
+ display_name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=32)]] = Field(
37
+ default=None,
38
+ description="The display name is a short name chosen by the user to identify the resource.",
39
+ alias="displayName",
40
+ )
41
+ filter: Optional[ConfigFilter] = None
42
+ __properties: ClassVar[List[str]] = ["description", "displayName", "filter"]
43
+
44
+ @field_validator("display_name")
45
+ def display_name_validate_regular_expression(cls, value):
46
+ """Validates the regular expression"""
47
+ if value is None:
48
+ return value
49
+
50
+ if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 \-]*$", value):
51
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 \-]*$/")
52
+ return value
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+ def to_str(self) -> str:
61
+ """Returns the string representation of the model using alias"""
62
+ return pprint.pformat(self.model_dump(by_alias=True))
63
+
64
+ def to_json(self) -> str:
65
+ """Returns the JSON representation of the model using alias"""
66
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
+ return json.dumps(self.to_dict())
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of UpdateTelemetryRouterPayload from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # override the default output from pydantic by calling `to_dict()` of filter
92
+ if self.filter:
93
+ _dict["filter"] = self.filter.to_dict()
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of UpdateTelemetryRouterPayload from a dict"""
99
+ if obj is None:
100
+ return None
101
+
102
+ if not isinstance(obj, dict):
103
+ return cls.model_validate(obj)
104
+
105
+ _obj = cls.model_validate(
106
+ {
107
+ "description": obj.get("description"),
108
+ "displayName": obj.get("displayName"),
109
+ "filter": ConfigFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None,
110
+ }
111
+ )
112
+ return _obj
File without changes