stackit-logs 0.2.1__tar.gz → 0.3.0__tar.gz

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. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/PKG-INFO +1 -1
  2. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/pyproject.toml +1 -1
  3. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/api_client.py +15 -17
  4. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/models/access_token.py +7 -3
  5. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/models/access_token_list.py +4 -3
  6. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/models/create_access_token_payload.py +7 -3
  7. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/models/create_logs_instance_payload.py +7 -3
  8. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/models/logs_instance.py +7 -3
  9. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/models/logs_instances_list.py +4 -3
  10. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/models/update_access_token_payload.py +7 -3
  11. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/models/update_logs_instance_payload.py +7 -3
  12. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/.gitignore +0 -0
  13. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/LICENSE.md +0 -0
  14. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/NOTICE.txt +0 -0
  15. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/README.md +0 -0
  16. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/__init__.py +0 -0
  17. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/api/__init__.py +0 -0
  18. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/api/default_api.py +0 -0
  19. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/api_response.py +0 -0
  20. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/configuration.py +0 -0
  21. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/exceptions.py +0 -0
  22. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/models/__init__.py +0 -0
  23. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/py.typed +0 -0
  24. {stackit_logs-0.2.1 → stackit_logs-0.3.0}/src/stackit/logs/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackit-logs
3
- Version: 0.2.1
3
+ Version: 0.3.0
4
4
  Summary: STACKIT Logs API
5
5
  Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
6
6
  Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stackit-logs"
3
- version = "v0.2.1"
3
+ version = "v0.3.0"
4
4
  description = "STACKIT Logs API"
5
5
  authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
6
6
  requires-python = ">=3.9,<4"
@@ -66,6 +66,7 @@ class ApiClient:
66
66
  "date": datetime.date,
67
67
  "datetime": datetime.datetime,
68
68
  "decimal": decimal.Decimal,
69
+ "UUID": uuid.UUID,
69
70
  "object": object,
70
71
  }
71
72
  _pool = None
@@ -265,7 +266,7 @@ class ApiClient:
265
266
  response_text = None
266
267
  return_data = None
267
268
  try:
268
- if response_type == "bytearray":
269
+ if response_type in ("bytearray", "bytes"):
269
270
  return_data = response_data.data
270
271
  elif response_type == "file":
271
272
  return_data = self.__deserialize_file(response_data)
@@ -326,25 +327,20 @@ class ApiClient:
326
327
  return obj.isoformat()
327
328
  elif isinstance(obj, decimal.Decimal):
328
329
  return str(obj)
329
-
330
330
  elif isinstance(obj, dict):
331
- obj_dict = obj
331
+ return {key: self.sanitize_for_serialization(val) for key, val in obj.items()}
332
+
333
+ # Convert model obj to dict except
334
+ # attributes `openapi_types`, `attribute_map`
335
+ # and attributes which value is not None.
336
+ # Convert attribute name to json key in
337
+ # model definition for request.
338
+ if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
339
+ obj_dict = obj.to_dict()
332
340
  else:
333
- # Convert model obj to dict except
334
- # attributes `openapi_types`, `attribute_map`
335
- # and attributes which value is not None.
336
- # Convert attribute name to json key in
337
- # model definition for request.
338
- if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
339
- obj_dict = obj.to_dict()
340
- else:
341
- obj_dict = obj.__dict__
342
-
343
- if isinstance(obj_dict, list):
344
- # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501
345
- return self.sanitize_for_serialization(obj_dict)
341
+ obj_dict = obj.__dict__
346
342
 
347
- return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}
343
+ return self.sanitize_for_serialization(obj_dict)
348
344
 
349
345
  def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
350
346
  """Deserializes response into an object.
@@ -417,6 +413,8 @@ class ApiClient:
417
413
  return self.__deserialize_datetime(data)
418
414
  elif klass is decimal.Decimal:
419
415
  return decimal.Decimal(data)
416
+ elif klass is uuid.UUID:
417
+ return uuid.UUID(data)
420
418
  elif issubclass(klass, Enum):
421
419
  return self.__deserialize_enum(data, klass)
422
420
  else:
@@ -28,6 +28,7 @@ from pydantic import (
28
28
  StrictStr,
29
29
  field_validator,
30
30
  )
31
+ from pydantic_core import to_jsonable_python
31
32
  from typing_extensions import Annotated, Self
32
33
 
33
34
 
@@ -70,6 +71,9 @@ class AccessToken(BaseModel):
70
71
  @field_validator("display_name")
71
72
  def display_name_validate_regular_expression(cls, value):
72
73
  """Validates the regular expression"""
74
+ if not isinstance(value, str):
75
+ value = str(value)
76
+
73
77
  if not re.match(r"^[a-zA-Z][\w -]*$", value):
74
78
  raise ValueError(r"must validate the regular expression /^[a-zA-Z][\w -]*$/")
75
79
  return value
@@ -103,7 +107,8 @@ class AccessToken(BaseModel):
103
107
  return value
104
108
 
105
109
  model_config = ConfigDict(
106
- populate_by_name=True,
110
+ validate_by_name=True,
111
+ validate_by_alias=True,
107
112
  validate_assignment=True,
108
113
  protected_namespaces=(),
109
114
  )
@@ -114,8 +119,7 @@ class AccessToken(BaseModel):
114
119
 
115
120
  def to_json(self) -> str:
116
121
  """Returns the JSON representation of the model using alias"""
117
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
118
- return json.dumps(self.to_dict())
122
+ return json.dumps(to_jsonable_python(self.to_dict()))
119
123
 
120
124
  @classmethod
121
125
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.logs.models.access_token import AccessToken
@@ -32,7 +33,8 @@ class AccessTokenList(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["tokens"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class AccessTokenList(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -42,6 +43,9 @@ class CreateAccessTokenPayload(BaseModel):
42
43
  @field_validator("display_name")
43
44
  def display_name_validate_regular_expression(cls, value):
44
45
  """Validates the regular expression"""
46
+ if not isinstance(value, str):
47
+ value = str(value)
48
+
45
49
  if not re.match(r"^[a-zA-Z][\w -]*$", value):
46
50
  raise ValueError(r"must validate the regular expression /^[a-zA-Z][\w -]*$/")
47
51
  return value
@@ -55,7 +59,8 @@ class CreateAccessTokenPayload(BaseModel):
55
59
  return value
56
60
 
57
61
  model_config = ConfigDict(
58
- populate_by_name=True,
62
+ validate_by_name=True,
63
+ validate_by_alias=True,
59
64
  validate_assignment=True,
60
65
  protected_namespaces=(),
61
66
  )
@@ -66,8 +71,7 @@ class CreateAccessTokenPayload(BaseModel):
66
71
 
67
72
  def to_json(self) -> str:
68
73
  """Returns the JSON representation of the model using alias"""
69
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
- return json.dumps(self.to_dict())
74
+ return json.dumps(to_jsonable_python(self.to_dict()))
71
75
 
72
76
  @classmethod
73
77
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -42,12 +43,16 @@ class CreateLogsInstancePayload(BaseModel):
42
43
  @field_validator("display_name")
43
44
  def display_name_validate_regular_expression(cls, value):
44
45
  """Validates the regular expression"""
46
+ if not isinstance(value, str):
47
+ value = str(value)
48
+
45
49
  if not re.match(r"^[a-zA-Z][\w -]*$", value):
46
50
  raise ValueError(r"must validate the regular expression /^[a-zA-Z][\w -]*$/")
47
51
  return value
48
52
 
49
53
  model_config = ConfigDict(
50
- populate_by_name=True,
54
+ validate_by_name=True,
55
+ validate_by_alias=True,
51
56
  validate_assignment=True,
52
57
  protected_namespaces=(),
53
58
  )
@@ -58,8 +63,7 @@ class CreateLogsInstancePayload(BaseModel):
58
63
 
59
64
  def to_json(self) -> str:
60
65
  """Returns the JSON representation of the model using alias"""
61
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
62
- return json.dumps(self.to_dict())
66
+ return json.dumps(to_jsonable_python(self.to_dict()))
63
67
 
64
68
  @classmethod
65
69
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
  from uuid import UUID
22
22
 
23
23
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24
+ from pydantic_core import to_jsonable_python
24
25
  from typing_extensions import Annotated, Self
25
26
 
26
27
 
@@ -88,6 +89,9 @@ class LogsInstance(BaseModel):
88
89
  @field_validator("display_name")
89
90
  def display_name_validate_regular_expression(cls, value):
90
91
  """Validates the regular expression"""
92
+ if not isinstance(value, str):
93
+ value = str(value)
94
+
91
95
  if not re.match(r"^[a-zA-Z][\w -]*$", value):
92
96
  raise ValueError(r"must validate the regular expression /^[a-zA-Z][\w -]*$/")
93
97
  return value
@@ -100,7 +104,8 @@ class LogsInstance(BaseModel):
100
104
  return value
101
105
 
102
106
  model_config = ConfigDict(
103
- populate_by_name=True,
107
+ validate_by_name=True,
108
+ validate_by_alias=True,
104
109
  validate_assignment=True,
105
110
  protected_namespaces=(),
106
111
  )
@@ -111,8 +116,7 @@ class LogsInstance(BaseModel):
111
116
 
112
117
  def to_json(self) -> str:
113
118
  """Returns the JSON representation of the model using alias"""
114
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
115
- return json.dumps(self.to_dict())
119
+ return json.dumps(to_jsonable_python(self.to_dict()))
116
120
 
117
121
  @classmethod
118
122
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.logs.models.logs_instance import LogsInstance
@@ -32,7 +33,8 @@ class LogsInstancesList(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["instances"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class LogsInstancesList(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -41,12 +42,16 @@ class UpdateAccessTokenPayload(BaseModel):
41
42
  if value is None:
42
43
  return value
43
44
 
45
+ if not isinstance(value, str):
46
+ value = str(value)
47
+
44
48
  if not re.match(r"^[a-zA-Z][\w -]*$", value):
45
49
  raise ValueError(r"must validate the regular expression /^[a-zA-Z][\w -]*$/")
46
50
  return value
47
51
 
48
52
  model_config = ConfigDict(
49
- populate_by_name=True,
53
+ validate_by_name=True,
54
+ validate_by_alias=True,
50
55
  validate_assignment=True,
51
56
  protected_namespaces=(),
52
57
  )
@@ -57,8 +62,7 @@ class UpdateAccessTokenPayload(BaseModel):
57
62
 
58
63
  def to_json(self) -> str:
59
64
  """Returns the JSON representation of the model using alias"""
60
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
- return json.dumps(self.to_dict())
65
+ return json.dumps(to_jsonable_python(self.to_dict()))
62
66
 
63
67
  @classmethod
64
68
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -45,12 +46,16 @@ class UpdateLogsInstancePayload(BaseModel):
45
46
  if value is None:
46
47
  return value
47
48
 
49
+ if not isinstance(value, str):
50
+ value = str(value)
51
+
48
52
  if not re.match(r"^[a-zA-Z][\w -]*$", value):
49
53
  raise ValueError(r"must validate the regular expression /^[a-zA-Z][\w -]*$/")
50
54
  return value
51
55
 
52
56
  model_config = ConfigDict(
53
- populate_by_name=True,
57
+ validate_by_name=True,
58
+ validate_by_alias=True,
54
59
  validate_assignment=True,
55
60
  protected_namespaces=(),
56
61
  )
@@ -61,8 +66,7 @@ class UpdateLogsInstancePayload(BaseModel):
61
66
 
62
67
  def to_json(self) -> str:
63
68
  """Returns the JSON representation of the model using alias"""
64
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
65
- return json.dumps(self.to_dict())
69
+ return json.dumps(to_jsonable_python(self.to_dict()))
66
70
 
67
71
  @classmethod
68
72
  def from_json(cls, json_str: str) -> Optional[Self]:
File without changes
File without changes
File without changes
File without changes