stackit-telemetrylink 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 (24) hide show
  1. src/stackit/telemetrylink/__init__.py +81 -0
  2. src/stackit/telemetrylink/api/__init__.py +4 -0
  3. src/stackit/telemetrylink/api/default_api.py +3296 -0
  4. src/stackit/telemetrylink/api_client.py +650 -0
  5. src/stackit/telemetrylink/api_response.py +23 -0
  6. src/stackit/telemetrylink/configuration.py +163 -0
  7. src/stackit/telemetrylink/exceptions.py +217 -0
  8. src/stackit/telemetrylink/models/__init__.py +36 -0
  9. src/stackit/telemetrylink/models/create_or_update_folder_telemetry_link_payload.py +126 -0
  10. src/stackit/telemetrylink/models/create_or_update_organization_telemetry_link_payload.py +126 -0
  11. src/stackit/telemetrylink/models/create_or_update_project_telemetry_link_payload.py +126 -0
  12. src/stackit/telemetrylink/models/partial_update_folder_telemetry_link_payload.py +138 -0
  13. src/stackit/telemetrylink/models/partial_update_organization_telemetry_link_payload.py +138 -0
  14. src/stackit/telemetrylink/models/partial_update_project_telemetry_link_payload.py +138 -0
  15. src/stackit/telemetrylink/models/response4xx.py +82 -0
  16. src/stackit/telemetrylink/models/telemetry_link_request.py +138 -0
  17. src/stackit/telemetrylink/models/telemetry_link_response.py +158 -0
  18. src/stackit/telemetrylink/py.typed +0 -0
  19. src/stackit/telemetrylink/rest.py +164 -0
  20. stackit_telemetrylink-0.1.0.dist-info/METADATA +48 -0
  21. stackit_telemetrylink-0.1.0.dist-info/RECORD +24 -0
  22. stackit_telemetrylink-0.1.0.dist-info/WHEEL +4 -0
  23. stackit_telemetrylink-0.1.0.dist-info/licenses/LICENSE.md +201 -0
  24. stackit_telemetrylink-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
@@ -0,0 +1,163 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Link API
5
+
6
+ This API provides endpoints for managing Telemetry Links. The Telemetry Link enables Log Routing towards a defined Telemetry Router.
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
+ import sys
15
+ from typing import Dict, List, Optional, TypedDict
16
+
17
+ from typing_extensions import NotRequired
18
+
19
+ import os
20
+
21
+
22
+ ServerVariablesT = Dict[str, str]
23
+
24
+
25
+ class HostSettingVariable(TypedDict):
26
+ description: str
27
+ default_value: str
28
+ enum_values: List[str]
29
+
30
+
31
+ class HostSetting(TypedDict):
32
+ url: str
33
+ description: str
34
+ variables: NotRequired[Dict[str, HostSettingVariable]]
35
+
36
+
37
+ class HostConfiguration:
38
+ def __init__(
39
+ self,
40
+ region=None,
41
+ server_index=None,
42
+ server_variables=None,
43
+ server_operation_index=None,
44
+ server_operation_variables=None,
45
+ ignore_operation_servers=False,
46
+ ) -> None:
47
+ print(
48
+ "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n",
49
+ "as a function argument instead of being set in the client configuration.\n"
50
+ "Once all services have migrated, the methods to specify the region in the client configuration "
51
+ "will be removed.",
52
+ file=sys.stderr,
53
+ )
54
+ """Constructor
55
+ """
56
+ self._base_path = "https://telemetry-link.api.stackit.cloud"
57
+ """Default Base url
58
+ """
59
+ self.server_index = 0 if server_index is None else server_index
60
+ self.server_operation_index = server_operation_index or {}
61
+ """Default server index
62
+ """
63
+ self.server_variables = server_variables or {}
64
+ if region:
65
+ self.server_variables["region"] = "{}.".format(region)
66
+ self.server_operation_variables = server_operation_variables or {}
67
+ """Default server variables
68
+ """
69
+ self.ignore_operation_servers = ignore_operation_servers
70
+ """Ignore operation servers
71
+ """
72
+
73
+ def get_host_settings(self) -> List[HostSetting]:
74
+ """Gets an array of host settings
75
+
76
+ :return: An array of host settings
77
+ """
78
+ return [
79
+ {
80
+ "url": "https://telemetry-link.api.stackit.cloud",
81
+ "description": "No description provided",
82
+ "variables": {
83
+ "region": {
84
+ "description": "No description provided",
85
+ "default_value": "global",
86
+ }
87
+ },
88
+ }
89
+ ]
90
+
91
+ def get_host_from_settings(
92
+ self,
93
+ index: Optional[int],
94
+ variables: Optional[ServerVariablesT] = None,
95
+ servers: Optional[List[HostSetting]] = None,
96
+ ) -> str:
97
+ """Gets host URL based on the index and variables
98
+ :param index: array index of the host settings
99
+ :param variables: hash of variable and the corresponding value
100
+ :param servers: an array of host settings or None
101
+ :error: if a region is given for a global url
102
+ :return: URL based on host settings
103
+ """
104
+ if index is None:
105
+ return self._base_path
106
+
107
+ variables = {} if variables is None else variables
108
+ servers = self.get_host_settings() if servers is None else servers
109
+
110
+ try:
111
+ server = servers[index]
112
+ except IndexError:
113
+ raise ValueError(
114
+ "Invalid index {0} when selecting the host settings. "
115
+ "Must be less than {1}".format(index, len(servers))
116
+ )
117
+
118
+ url = server["url"]
119
+
120
+ # check if environment variable was provided for region
121
+ # if nothing was set this is None
122
+ region_env = os.environ.get("STACKIT_REGION")
123
+
124
+ # go through variables and replace placeholders
125
+ for variable_name, variable in server.get("variables", {}).items():
126
+ # If a region is provided by the user for a global url
127
+ # return an error (except for providing via environment variable).
128
+ # The region is provided as a function argument instead of being set in the client configuration.
129
+ if (
130
+ variable_name == "region"
131
+ and (variable["default_value"] == "global" or variable["default_value"] == "")
132
+ and region_env is None
133
+ and variables.get(variable_name) is not None
134
+ ):
135
+ raise ValueError(
136
+ "this API does not support setting a region in the client configuration, "
137
+ "please check if the region can be specified as a function parameter"
138
+ )
139
+ used_value = variables.get(variable_name, variable["default_value"])
140
+
141
+ if "enum_values" in variable and used_value not in variable["enum_values"]:
142
+ given_value = variables[variable_name].replace(".", "")
143
+ valid_values = [v.replace(".", "") for v in variable["enum_values"]]
144
+ raise ValueError(
145
+ "The variable `{0}` in the host URL has invalid value '{1}'. Must be '{2}'.".format(
146
+ variable_name, given_value, valid_values
147
+ )
148
+ )
149
+
150
+ url = url.replace("{" + variable_name + "}", used_value)
151
+
152
+ return url
153
+
154
+ @property
155
+ def host(self) -> str:
156
+ """Return generated host."""
157
+ return self.get_host_from_settings(self.server_index, variables=self.server_variables)
158
+
159
+ @host.setter
160
+ def host(self, value: str) -> None:
161
+ """Fix base path."""
162
+ self._base_path = value
163
+ self.server_index = None
@@ -0,0 +1,217 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Link API
5
+
6
+ This API provides endpoints for managing Telemetry Links. The Telemetry Link enables Log Routing towards a defined Telemetry Router.
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 typing import Any, Optional
15
+
16
+ from typing_extensions import Self
17
+
18
+
19
+ class OpenApiException(Exception):
20
+ """The base exception class for all OpenAPIExceptions"""
21
+
22
+
23
+ class ApiTypeError(OpenApiException, TypeError):
24
+ def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None:
25
+ """Raises an exception for TypeErrors
26
+
27
+ Args:
28
+ msg (str): the exception message
29
+
30
+ Keyword Args:
31
+ path_to_item (list): a list of keys an indices to get to the
32
+ current_item
33
+ None if unset
34
+ valid_classes (tuple): the primitive classes that current item
35
+ should be an instance of
36
+ None if unset
37
+ key_type (bool): False if our value is a value in a dict
38
+ True if it is a key in a dict
39
+ False if our item is an item in a list
40
+ None if unset
41
+ """
42
+ self.path_to_item = path_to_item
43
+ self.valid_classes = valid_classes
44
+ self.key_type = key_type
45
+ full_msg = msg
46
+ if path_to_item:
47
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
48
+ super(ApiTypeError, self).__init__(full_msg)
49
+
50
+
51
+ class ApiValueError(OpenApiException, ValueError):
52
+ def __init__(self, msg, path_to_item=None) -> None:
53
+ """
54
+ Args:
55
+ msg (str): the exception message
56
+
57
+ Keyword Args:
58
+ path_to_item (list) the path to the exception in the
59
+ received_data dict. None if unset
60
+ """
61
+
62
+ self.path_to_item = path_to_item
63
+ full_msg = msg
64
+ if path_to_item:
65
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
66
+ super(ApiValueError, self).__init__(full_msg)
67
+
68
+
69
+ class ApiAttributeError(OpenApiException, AttributeError):
70
+ def __init__(self, msg, path_to_item=None) -> None:
71
+ """
72
+ Raised when an attribute reference or assignment fails.
73
+
74
+ Args:
75
+ msg (str): the exception message
76
+
77
+ Keyword Args:
78
+ path_to_item (None/list) the path to the exception in the
79
+ received_data dict
80
+ """
81
+ self.path_to_item = path_to_item
82
+ full_msg = msg
83
+ if path_to_item:
84
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
85
+ super(ApiAttributeError, self).__init__(full_msg)
86
+
87
+
88
+ class ApiKeyError(OpenApiException, KeyError):
89
+ def __init__(self, msg, path_to_item=None) -> None:
90
+ """
91
+ Args:
92
+ msg (str): the exception message
93
+
94
+ Keyword Args:
95
+ path_to_item (None/list) the path to the exception in the
96
+ received_data dict
97
+ """
98
+ self.path_to_item = path_to_item
99
+ full_msg = msg
100
+ if path_to_item:
101
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
102
+ super(ApiKeyError, self).__init__(full_msg)
103
+
104
+
105
+ class ApiException(OpenApiException):
106
+
107
+ def __init__(
108
+ self,
109
+ status=None,
110
+ reason=None,
111
+ http_resp=None,
112
+ *,
113
+ body: Optional[str] = None,
114
+ data: Optional[Any] = None,
115
+ ) -> None:
116
+ self.status = status
117
+ self.reason = reason
118
+ self.body = body
119
+ self.data = data
120
+ self.headers = None
121
+
122
+ if http_resp:
123
+ if self.status is None:
124
+ self.status = http_resp.status
125
+ if self.reason is None:
126
+ self.reason = http_resp.reason
127
+ if self.body is None:
128
+ try:
129
+ self.body = http_resp.data.decode("utf-8")
130
+ except Exception: # noqa: S110
131
+ pass
132
+ self.headers = http_resp.headers
133
+
134
+ @classmethod
135
+ def from_response(
136
+ cls,
137
+ *,
138
+ http_resp,
139
+ body: Optional[str],
140
+ data: Optional[Any],
141
+ ) -> Self:
142
+ if http_resp.status == 400:
143
+ raise BadRequestException(http_resp=http_resp, body=body, data=data)
144
+
145
+ if http_resp.status == 401:
146
+ raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
147
+
148
+ if http_resp.status == 403:
149
+ raise ForbiddenException(http_resp=http_resp, body=body, data=data)
150
+
151
+ if http_resp.status == 404:
152
+ raise NotFoundException(http_resp=http_resp, body=body, data=data)
153
+
154
+ # Added new conditions for 409 and 422
155
+ if http_resp.status == 409:
156
+ raise ConflictException(http_resp=http_resp, body=body, data=data)
157
+
158
+ if http_resp.status == 422:
159
+ raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
160
+
161
+ if 500 <= http_resp.status <= 599:
162
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
163
+ raise ApiException(http_resp=http_resp, body=body, data=data)
164
+
165
+ def __str__(self):
166
+ """Custom error messages for exception"""
167
+ error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
168
+ if self.headers:
169
+ error_message += "HTTP response headers: {0}\n".format(self.headers)
170
+
171
+ if self.data or self.body:
172
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
173
+
174
+ return error_message
175
+
176
+
177
+ class BadRequestException(ApiException):
178
+ pass
179
+
180
+
181
+ class NotFoundException(ApiException):
182
+ pass
183
+
184
+
185
+ class UnauthorizedException(ApiException):
186
+ pass
187
+
188
+
189
+ class ForbiddenException(ApiException):
190
+ pass
191
+
192
+
193
+ class ServiceException(ApiException):
194
+ pass
195
+
196
+
197
+ class ConflictException(ApiException):
198
+ """Exception for HTTP 409 Conflict."""
199
+
200
+ pass
201
+
202
+
203
+ class UnprocessableEntityException(ApiException):
204
+ """Exception for HTTP 422 Unprocessable Entity."""
205
+
206
+ pass
207
+
208
+
209
+ def render_path(path_to_item):
210
+ """Returns a string representation of a path"""
211
+ result = ""
212
+ for pth in path_to_item:
213
+ if isinstance(pth, int):
214
+ result += "[{0}]".format(pth)
215
+ else:
216
+ result += "['{0}']".format(pth)
217
+ return result
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ STACKIT Telemetry Link API
6
+
7
+ This API provides endpoints for managing Telemetry Links. The Telemetry Link enables Log Routing towards a defined Telemetry Router.
8
+
9
+ The version of the OpenAPI document: 1beta.0.0
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ # import models into model package
16
+ from stackit.telemetrylink.models.create_or_update_folder_telemetry_link_payload import (
17
+ CreateOrUpdateFolderTelemetryLinkPayload,
18
+ )
19
+ from stackit.telemetrylink.models.create_or_update_organization_telemetry_link_payload import (
20
+ CreateOrUpdateOrganizationTelemetryLinkPayload,
21
+ )
22
+ from stackit.telemetrylink.models.create_or_update_project_telemetry_link_payload import (
23
+ CreateOrUpdateProjectTelemetryLinkPayload,
24
+ )
25
+ from stackit.telemetrylink.models.partial_update_folder_telemetry_link_payload import (
26
+ PartialUpdateFolderTelemetryLinkPayload,
27
+ )
28
+ from stackit.telemetrylink.models.partial_update_organization_telemetry_link_payload import (
29
+ PartialUpdateOrganizationTelemetryLinkPayload,
30
+ )
31
+ from stackit.telemetrylink.models.partial_update_project_telemetry_link_payload import (
32
+ PartialUpdateProjectTelemetryLinkPayload,
33
+ )
34
+ from stackit.telemetrylink.models.response4xx import Response4xx
35
+ from stackit.telemetrylink.models.telemetry_link_request import TelemetryLinkRequest
36
+ from stackit.telemetrylink.models.telemetry_link_response import TelemetryLinkResponse
@@ -0,0 +1,126 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Link API
5
+
6
+ This API provides endpoints for managing Telemetry Links. The Telemetry Link enables Log Routing towards a defined Telemetry Router.
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, StrictBool, field_validator
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Annotated, Self
24
+
25
+
26
+ class CreateOrUpdateFolderTelemetryLinkPayload(BaseModel):
27
+ """
28
+ CreateOrUpdateFolderTelemetryLinkPayload
29
+ """ # noqa: E501
30
+
31
+ access_token: Annotated[str, Field(strict=True)] = Field(description="The access token.", alias="accessToken")
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: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field(
37
+ description="The display name is a short name chosen by the user to identify the resource.", alias="displayName"
38
+ )
39
+ enabled: StrictBool = Field(
40
+ description="Indicates whether routing through the link to a telemetry-router is active."
41
+ )
42
+ telemetry_router_id: Annotated[str, Field(strict=True, max_length=1024)] = Field(
43
+ description="The ID of the telemetry-router to route the telemetry data.", alias="telemetryRouterId"
44
+ )
45
+ __properties: ClassVar[List[str]] = ["accessToken", "description", "displayName", "enabled", "telemetryRouterId"]
46
+
47
+ @field_validator("access_token")
48
+ def access_token_validate_regular_expression(cls, value):
49
+ """Validates the regular expression"""
50
+ if not isinstance(value, str):
51
+ value = str(value)
52
+
53
+ if not re.match(r"^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+\/=]*$", value):
54
+ raise ValueError(
55
+ r"must validate the regular expression /^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+\/=]*$/"
56
+ )
57
+ return value
58
+
59
+ @field_validator("display_name")
60
+ def display_name_validate_regular_expression(cls, value):
61
+ """Validates the regular expression"""
62
+ if not isinstance(value, str):
63
+ value = str(value)
64
+
65
+ if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 \-]*$", value):
66
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 \-]*$/")
67
+ return value
68
+
69
+ model_config = ConfigDict(
70
+ validate_by_name=True,
71
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
83
+
84
+ @classmethod
85
+ def from_json(cls, json_str: str) -> Optional[Self]:
86
+ """Create an instance of CreateOrUpdateFolderTelemetryLinkPayload from a JSON string"""
87
+ return cls.from_dict(json.loads(json_str))
88
+
89
+ def to_dict(self) -> Dict[str, Any]:
90
+ """Return the dictionary representation of the model using alias.
91
+
92
+ This has the following differences from calling pydantic's
93
+ `self.model_dump(by_alias=True)`:
94
+
95
+ * `None` is only added to the output dict for nullable fields that
96
+ were set at model initialization. Other fields with value `None`
97
+ are ignored.
98
+ """
99
+ excluded_fields: Set[str] = set([])
100
+
101
+ _dict = self.model_dump(
102
+ by_alias=True,
103
+ exclude=excluded_fields,
104
+ exclude_none=True,
105
+ )
106
+ return _dict
107
+
108
+ @classmethod
109
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
110
+ """Create an instance of CreateOrUpdateFolderTelemetryLinkPayload from a dict"""
111
+ if obj is None:
112
+ return None
113
+
114
+ if not isinstance(obj, dict):
115
+ return cls.model_validate(obj)
116
+
117
+ _obj = cls.model_validate(
118
+ {
119
+ "accessToken": obj.get("accessToken"),
120
+ "description": obj.get("description"),
121
+ "displayName": obj.get("displayName"),
122
+ "enabled": obj.get("enabled") if obj.get("enabled") is not None else True,
123
+ "telemetryRouterId": obj.get("telemetryRouterId"),
124
+ }
125
+ )
126
+ return _obj
@@ -0,0 +1,126 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Telemetry Link API
5
+
6
+ This API provides endpoints for managing Telemetry Links. The Telemetry Link enables Log Routing towards a defined Telemetry Router.
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, StrictBool, field_validator
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Annotated, Self
24
+
25
+
26
+ class CreateOrUpdateOrganizationTelemetryLinkPayload(BaseModel):
27
+ """
28
+ CreateOrUpdateOrganizationTelemetryLinkPayload
29
+ """ # noqa: E501
30
+
31
+ access_token: Annotated[str, Field(strict=True)] = Field(description="The access token.", alias="accessToken")
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: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field(
37
+ description="The display name is a short name chosen by the user to identify the resource.", alias="displayName"
38
+ )
39
+ enabled: StrictBool = Field(
40
+ description="Indicates whether routing through the link to a telemetry-router is active."
41
+ )
42
+ telemetry_router_id: Annotated[str, Field(strict=True, max_length=1024)] = Field(
43
+ description="The ID of the telemetry-router to route the telemetry data.", alias="telemetryRouterId"
44
+ )
45
+ __properties: ClassVar[List[str]] = ["accessToken", "description", "displayName", "enabled", "telemetryRouterId"]
46
+
47
+ @field_validator("access_token")
48
+ def access_token_validate_regular_expression(cls, value):
49
+ """Validates the regular expression"""
50
+ if not isinstance(value, str):
51
+ value = str(value)
52
+
53
+ if not re.match(r"^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+\/=]*$", value):
54
+ raise ValueError(
55
+ r"must validate the regular expression /^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+\/=]*$/"
56
+ )
57
+ return value
58
+
59
+ @field_validator("display_name")
60
+ def display_name_validate_regular_expression(cls, value):
61
+ """Validates the regular expression"""
62
+ if not isinstance(value, str):
63
+ value = str(value)
64
+
65
+ if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 \-]*$", value):
66
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 \-]*$/")
67
+ return value
68
+
69
+ model_config = ConfigDict(
70
+ validate_by_name=True,
71
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
83
+
84
+ @classmethod
85
+ def from_json(cls, json_str: str) -> Optional[Self]:
86
+ """Create an instance of CreateOrUpdateOrganizationTelemetryLinkPayload from a JSON string"""
87
+ return cls.from_dict(json.loads(json_str))
88
+
89
+ def to_dict(self) -> Dict[str, Any]:
90
+ """Return the dictionary representation of the model using alias.
91
+
92
+ This has the following differences from calling pydantic's
93
+ `self.model_dump(by_alias=True)`:
94
+
95
+ * `None` is only added to the output dict for nullable fields that
96
+ were set at model initialization. Other fields with value `None`
97
+ are ignored.
98
+ """
99
+ excluded_fields: Set[str] = set([])
100
+
101
+ _dict = self.model_dump(
102
+ by_alias=True,
103
+ exclude=excluded_fields,
104
+ exclude_none=True,
105
+ )
106
+ return _dict
107
+
108
+ @classmethod
109
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
110
+ """Create an instance of CreateOrUpdateOrganizationTelemetryLinkPayload from a dict"""
111
+ if obj is None:
112
+ return None
113
+
114
+ if not isinstance(obj, dict):
115
+ return cls.model_validate(obj)
116
+
117
+ _obj = cls.model_validate(
118
+ {
119
+ "accessToken": obj.get("accessToken"),
120
+ "description": obj.get("description"),
121
+ "displayName": obj.get("displayName"),
122
+ "enabled": obj.get("enabled") if obj.get("enabled") is not None else True,
123
+ "telemetryRouterId": obj.get("telemetryRouterId"),
124
+ }
125
+ )
126
+ return _obj