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,36 @@
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
+ from enum import Enum
18
+
19
+ from typing_extensions import Self
20
+
21
+
22
+ class DestinationConfigType(str, Enum):
23
+ """
24
+ Type of the destination.
25
+ """
26
+
27
+ """
28
+ allowed enum values
29
+ """
30
+ OPENTELEMETRY = "OpenTelemetry"
31
+ S3 = "S3"
32
+
33
+ @classmethod
34
+ def from_json(cls, json_str: str) -> Self:
35
+ """Create an instance of DestinationConfigType from a JSON string"""
36
+ return cls(json.loads(json_str))
@@ -0,0 +1,152 @@
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.destination_config import DestinationConfig
27
+
28
+
29
+ class DestinationResponse(BaseModel):
30
+ """
31
+ DestinationResponse
32
+ """ # noqa: E501
33
+
34
+ config: DestinationConfig
35
+ creation_time: datetime = Field(description="The point in time the resource was created.", alias="creationTime")
36
+ credential_type: StrictStr = Field(description="The credential type for the resource.", alias="credentialType")
37
+ description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
38
+ default=None,
39
+ description="The description is a longer text chosen by the user to provide more context for the resource.",
40
+ )
41
+ display_name: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field(
42
+ description="The display name is a short name chosen by the user to identify the resource.", alias="displayName"
43
+ )
44
+ id: UUID = Field(description="A auto generated unique id which identifies the resource.")
45
+ status: StrictStr = Field(description="The current status of the resource.")
46
+ __properties: ClassVar[List[str]] = [
47
+ "config",
48
+ "creationTime",
49
+ "credentialType",
50
+ "description",
51
+ "displayName",
52
+ "id",
53
+ "status",
54
+ ]
55
+
56
+ @field_validator("creation_time", mode="before")
57
+ def creation_time_change_year_zero_to_one(cls, value):
58
+ """Workaround which prevents year 0 issue"""
59
+ if isinstance(value, str):
60
+ # Check for year "0000" at the beginning of the string
61
+ # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
62
+ if value.startswith("0000-01-01T") and re.match(
63
+ r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
64
+ ):
65
+ # Workaround: Replace "0000" with "0001"
66
+ return "0001" + value[4:] # Take "0001" and append the rest of the string
67
+ return value
68
+
69
+ @field_validator("credential_type")
70
+ def credential_type_validate_enum(cls, value):
71
+ """Validates the enum"""
72
+ if value not in set(["bearerToken", "basicAuth", "accessKey"]):
73
+ raise ValueError("must be one of enum values ('bearerToken', 'basicAuth', 'accessKey')")
74
+ return value
75
+
76
+ @field_validator("display_name")
77
+ def display_name_validate_regular_expression(cls, value):
78
+ """Validates the regular expression"""
79
+ if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 \-]*$", value):
80
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 \-]*$/")
81
+ return value
82
+
83
+ @field_validator("status")
84
+ def status_validate_enum(cls, value):
85
+ """Validates the enum"""
86
+ if value not in set(["reconciling", "active", "deleting"]):
87
+ raise ValueError("must be one of enum values ('reconciling', 'active', 'deleting')")
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 DestinationResponse 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 config
128
+ if self.config:
129
+ _dict["config"] = self.config.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 DestinationResponse 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
+ "config": DestinationConfig.from_dict(obj["config"]) if obj.get("config") is not None else None,
144
+ "creationTime": obj.get("creationTime"),
145
+ "credentialType": obj.get("credentialType"),
146
+ "description": obj.get("description"),
147
+ "displayName": obj.get("displayName"),
148
+ "id": obj.get("id"),
149
+ "status": obj.get("status"),
150
+ }
151
+ )
152
+ 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 GetAccessTokenResponse(BaseModel):
28
+ """
29
+ GetAccessTokenResponse
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 GetAccessTokenResponse 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 GetAccessTokenResponse 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,104 @@
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
+ from stackit.telemetryrouter.models.get_access_token_response import (
24
+ GetAccessTokenResponse,
25
+ )
26
+
27
+
28
+ class ListAccessTokensResponse(BaseModel):
29
+ """
30
+ ListAccessTokensResponse
31
+ """ # noqa: E501
32
+
33
+ access_tokens: List[GetAccessTokenResponse] = Field(alias="accessTokens")
34
+ next_page_token: Optional[StrictStr] = Field(
35
+ default=None, description="A token to retrieve the next page of results.", alias="nextPageToken"
36
+ )
37
+ __properties: ClassVar[List[str]] = ["accessTokens", "nextPageToken"]
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 ListAccessTokensResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in access_tokens (list)
77
+ _items = []
78
+ if self.access_tokens:
79
+ for _item_access_tokens in self.access_tokens:
80
+ if _item_access_tokens:
81
+ _items.append(_item_access_tokens.to_dict())
82
+ _dict["accessTokens"] = _items
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of ListAccessTokensResponse from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate(
95
+ {
96
+ "accessTokens": (
97
+ [GetAccessTokenResponse.from_dict(_item) for _item in obj["accessTokens"]]
98
+ if obj.get("accessTokens") is not None
99
+ else None
100
+ ),
101
+ "nextPageToken": obj.get("nextPageToken"),
102
+ }
103
+ )
104
+ return _obj
@@ -0,0 +1,102 @@
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
+ from stackit.telemetryrouter.models.destination_response import DestinationResponse
24
+
25
+
26
+ class ListDestinationsResponse(BaseModel):
27
+ """
28
+ ListDestinationsResponse
29
+ """ # noqa: E501
30
+
31
+ destinations: List[DestinationResponse]
32
+ next_page_token: Optional[StrictStr] = Field(
33
+ default=None, description="A token to retrieve the next page of results.", alias="nextPageToken"
34
+ )
35
+ __properties: ClassVar[List[str]] = ["destinations", "nextPageToken"]
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 ListDestinationsResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in destinations (list)
75
+ _items = []
76
+ if self.destinations:
77
+ for _item_destinations in self.destinations:
78
+ if _item_destinations:
79
+ _items.append(_item_destinations.to_dict())
80
+ _dict["destinations"] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of ListDestinationsResponse 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
+ "destinations": (
95
+ [DestinationResponse.from_dict(_item) for _item in obj["destinations"]]
96
+ if obj.get("destinations") is not None
97
+ else None
98
+ ),
99
+ "nextPageToken": obj.get("nextPageToken"),
100
+ }
101
+ )
102
+ return _obj
@@ -0,0 +1,104 @@
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
+ from stackit.telemetryrouter.models.telemetry_router_response import (
24
+ TelemetryRouterResponse,
25
+ )
26
+
27
+
28
+ class ListTelemetryRoutersResponse(BaseModel):
29
+ """
30
+ ListTelemetryRoutersResponse
31
+ """ # noqa: E501
32
+
33
+ next_page_token: Optional[StrictStr] = Field(
34
+ default=None, description="A token to retrieve the next page of results.", alias="nextPageToken"
35
+ )
36
+ telemetry_routers: List[TelemetryRouterResponse] = Field(alias="telemetryRouters")
37
+ __properties: ClassVar[List[str]] = ["nextPageToken", "telemetryRouters"]
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 ListTelemetryRoutersResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in telemetry_routers (list)
77
+ _items = []
78
+ if self.telemetry_routers:
79
+ for _item_telemetry_routers in self.telemetry_routers:
80
+ if _item_telemetry_routers:
81
+ _items.append(_item_telemetry_routers.to_dict())
82
+ _dict["telemetryRouters"] = _items
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of ListTelemetryRoutersResponse from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate(
95
+ {
96
+ "nextPageToken": obj.get("nextPageToken"),
97
+ "telemetryRouters": (
98
+ [TelemetryRouterResponse.from_dict(_item) for _item in obj["telemetryRouters"]]
99
+ if obj.get("telemetryRouters") is not None
100
+ else None
101
+ ),
102
+ }
103
+ )
104
+ return _obj