pulp-python-client 3.12.5__py3-none-any.whl → 3.13.1__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.

Potentially problematic release.


This version of pulp-python-client might be problematic. Click here for more details.

Files changed (68) hide show
  1. pulp_python_client-3.13.1.dist-info/METADATA +17 -0
  2. pulp_python_client-3.13.1.dist-info/RECORD +64 -0
  3. {pulp_python_client-3.12.5.dist-info → pulp_python_client-3.13.1.dist-info}/WHEEL +1 -1
  4. pulpcore/client/pulp_python/__init__.py +9 -10
  5. pulpcore/client/pulp_python/api/__init__.py +1 -2
  6. pulpcore/client/pulp_python/api/content_packages_api.py +1800 -655
  7. pulpcore/client/pulp_python/api/distributions_pypi_api.py +3755 -1474
  8. pulpcore/client/pulp_python/api/publications_pypi_api.py +2574 -982
  9. pulpcore/client/pulp_python/api/pypi_api.py +302 -128
  10. pulpcore/client/pulp_python/api/pypi_legacy_api.py +326 -153
  11. pulpcore/client/pulp_python/api/pypi_metadata_api.py +319 -139
  12. pulpcore/client/pulp_python/api/pypi_simple_api.py +899 -382
  13. pulpcore/client/pulp_python/api/remotes_python_api.py +4092 -1589
  14. pulpcore/client/pulp_python/api/repositories_python_api.py +4380 -1719
  15. pulpcore/client/pulp_python/api/repositories_python_versions_api.py +1526 -561
  16. pulpcore/client/pulp_python/api_client.py +444 -313
  17. pulpcore/client/pulp_python/api_response.py +21 -0
  18. pulpcore/client/pulp_python/configuration.py +266 -73
  19. pulpcore/client/pulp_python/exceptions.py +99 -20
  20. pulpcore/client/pulp_python/models/__init__.py +5 -8
  21. pulpcore/client/pulp_python/models/async_operation_response.py +60 -96
  22. pulpcore/client/pulp_python/models/content_summary_response.py +70 -154
  23. pulpcore/client/pulp_python/models/exclude_platforms_enum.py +19 -82
  24. pulpcore/client/pulp_python/models/my_permissions_response.py +60 -94
  25. pulpcore/client/pulp_python/models/nested_role.py +71 -155
  26. pulpcore/client/pulp_python/models/nested_role_response.py +70 -152
  27. pulpcore/client/pulp_python/models/object_roles_response.py +70 -96
  28. pulpcore/client/pulp_python/models/package_metadata_response.py +91 -191
  29. pulpcore/client/pulp_python/models/package_types_enum.py +23 -86
  30. pulpcore/client/pulp_python/models/package_upload_task_response.py +85 -154
  31. pulpcore/client/pulp_python/models/paginated_repository_version_response_list.py +94 -181
  32. pulpcore/client/pulp_python/models/paginatedpython_python_distribution_response_list.py +94 -181
  33. pulpcore/client/pulp_python/models/paginatedpython_python_package_content_response_list.py +94 -181
  34. pulpcore/client/pulp_python/models/paginatedpython_python_publication_response_list.py +94 -181
  35. pulpcore/client/pulp_python/models/paginatedpython_python_remote_response_list.py +94 -181
  36. pulpcore/client/pulp_python/models/paginatedpython_python_repository_response_list.py +94 -181
  37. pulpcore/client/pulp_python/models/patchedpython_python_distribution.py +108 -330
  38. pulpcore/client/pulp_python/models/patchedpython_python_remote.py +204 -864
  39. pulpcore/client/pulp_python/models/patchedpython_python_repository.py +96 -249
  40. pulpcore/client/pulp_python/models/policy_enum.py +18 -81
  41. pulpcore/client/pulp_python/models/python_python_distribution.py +108 -332
  42. pulpcore/client/pulp_python/models/python_python_distribution_response.py +132 -490
  43. pulpcore/client/pulp_python/models/python_python_package_content_response.py +182 -972
  44. pulpcore/client/pulp_python/models/python_python_publication.py +68 -127
  45. pulpcore/client/pulp_python/models/python_python_publication_response.py +93 -269
  46. pulpcore/client/pulp_python/models/python_python_remote.py +204 -866
  47. pulpcore/client/pulp_python/models/python_python_remote_response.py +198 -839
  48. pulpcore/client/pulp_python/models/python_python_remote_response_hidden_fields_inner.py +90 -0
  49. pulpcore/client/pulp_python/models/python_python_repository.py +96 -250
  50. pulpcore/client/pulp_python/models/python_python_repository_response.py +122 -407
  51. pulpcore/client/pulp_python/models/repair.py +60 -95
  52. pulpcore/client/pulp_python/models/repository_add_remove_content.py +71 -157
  53. pulpcore/client/pulp_python/models/repository_sync_url.py +68 -129
  54. pulpcore/client/pulp_python/models/repository_version_response.py +104 -296
  55. pulpcore/client/pulp_python/models/set_label.py +80 -130
  56. pulpcore/client/pulp_python/models/set_label_response.py +80 -127
  57. pulpcore/client/pulp_python/models/summary_response.py +70 -160
  58. pulpcore/client/pulp_python/models/unset_label.py +75 -107
  59. pulpcore/client/pulp_python/models/unset_label_response.py +78 -129
  60. pulpcore/client/pulp_python/py.typed +0 -0
  61. pulpcore/client/pulp_python/rest.py +136 -170
  62. pulp_python_client-3.12.5.dist-info/METADATA +0 -17
  63. pulp_python_client-3.12.5.dist-info/RECORD +0 -65
  64. pulpcore/client/pulp_python/models/package_upload.py +0 -190
  65. pulpcore/client/pulp_python/models/python_bander_remote.py +0 -184
  66. pulpcore/client/pulp_python/models/python_python_package_content.py +0 -889
  67. pulpcore/client/pulp_python/models/python_python_remote_response_hidden_fields.py +0 -149
  68. {pulp_python_client-3.12.5.dist-info → pulp_python_client-3.13.1.dist-info}/top_level.txt +0 -0
@@ -3,311 +3,119 @@
3
3
  """
4
4
  Pulp 3 API
5
5
 
6
- Fetch, Upload, Organize, and Distribute Software Packages # noqa: E501
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
7
 
8
8
  The version of the OpenAPI document: v3
9
9
  Contact: pulp-list@redhat.com
10
- Generated by: https://openapi-generator.tech
11
- """
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
12
14
 
13
15
 
16
+ from __future__ import annotations
14
17
  import pprint
15
18
  import re # noqa: F401
19
+ import json
16
20
 
17
- import six
18
-
19
- from pulpcore.client.pulp_python.configuration import Configuration
20
-
21
-
22
- class RepositoryVersionResponse(object):
23
- """NOTE: This class is auto generated by OpenAPI Generator.
24
- Ref: https://openapi-generator.tech
25
-
26
- Do not edit the class manually.
27
- """
21
+ from datetime import datetime
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from pulpcore.client.pulp_python.models.content_summary_response import ContentSummaryResponse
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
28
27
 
28
+ class RepositoryVersionResponse(BaseModel):
29
29
  """
30
- Attributes:
31
- openapi_types (dict): The key is attribute name
32
- and the value is attribute type.
33
- attribute_map (dict): The key is attribute name
34
- and the value is json key in definition.
35
- """
36
- openapi_types = {
37
- 'pulp_href': 'str',
38
- 'prn': 'str',
39
- 'pulp_created': 'datetime',
40
- 'pulp_last_updated': 'datetime',
41
- 'number': 'int',
42
- 'repository': 'str',
43
- 'base_version': 'str',
44
- 'content_summary': 'ContentSummaryResponse'
45
- }
46
-
47
- attribute_map = {
48
- 'pulp_href': 'pulp_href',
49
- 'prn': 'prn',
50
- 'pulp_created': 'pulp_created',
51
- 'pulp_last_updated': 'pulp_last_updated',
52
- 'number': 'number',
53
- 'repository': 'repository',
54
- 'base_version': 'base_version',
55
- 'content_summary': 'content_summary'
56
- }
57
-
58
- def __init__(self, pulp_href=None, prn=None, pulp_created=None, pulp_last_updated=None, number=None, repository=None, base_version=None, content_summary=None, local_vars_configuration=None): # noqa: E501
59
- """RepositoryVersionResponse - a model defined in OpenAPI""" # noqa: E501
60
- if local_vars_configuration is None:
61
- local_vars_configuration = Configuration()
62
- self.local_vars_configuration = local_vars_configuration
63
-
64
- self._pulp_href = None
65
- self._prn = None
66
- self._pulp_created = None
67
- self._pulp_last_updated = None
68
- self._number = None
69
- self._repository = None
70
- self._base_version = None
71
- self._content_summary = None
72
- self.discriminator = None
73
-
74
- if pulp_href is not None:
75
- self.pulp_href = pulp_href
76
- if prn is not None:
77
- self.prn = prn
78
- if pulp_created is not None:
79
- self.pulp_created = pulp_created
80
- if pulp_last_updated is not None:
81
- self.pulp_last_updated = pulp_last_updated
82
- if number is not None:
83
- self.number = number
84
- if repository is not None:
85
- self.repository = repository
86
- if base_version is not None:
87
- self.base_version = base_version
88
- if content_summary is not None:
89
- self.content_summary = content_summary
90
-
91
- @property
92
- def pulp_href(self):
93
- """Gets the pulp_href of this RepositoryVersionResponse. # noqa: E501
94
-
95
-
96
- :return: The pulp_href of this RepositoryVersionResponse. # noqa: E501
97
- :rtype: str
98
- """
99
- return self._pulp_href
100
-
101
- @pulp_href.setter
102
- def pulp_href(self, pulp_href):
103
- """Sets the pulp_href of this RepositoryVersionResponse.
104
-
105
-
106
- :param pulp_href: The pulp_href of this RepositoryVersionResponse. # noqa: E501
107
- :type: str
108
- """
109
-
110
- self._pulp_href = pulp_href
111
-
112
- @property
113
- def prn(self):
114
- """Gets the prn of this RepositoryVersionResponse. # noqa: E501
115
-
116
- The Pulp Resource Name (PRN). # noqa: E501
117
-
118
- :return: The prn of this RepositoryVersionResponse. # noqa: E501
119
- :rtype: str
120
- """
121
- return self._prn
122
-
123
- @prn.setter
124
- def prn(self, prn):
125
- """Sets the prn of this RepositoryVersionResponse.
126
-
127
- The Pulp Resource Name (PRN). # noqa: E501
128
-
129
- :param prn: The prn of this RepositoryVersionResponse. # noqa: E501
130
- :type: str
131
- """
132
-
133
- self._prn = prn
134
-
135
- @property
136
- def pulp_created(self):
137
- """Gets the pulp_created of this RepositoryVersionResponse. # noqa: E501
138
-
139
- Timestamp of creation. # noqa: E501
140
-
141
- :return: The pulp_created of this RepositoryVersionResponse. # noqa: E501
142
- :rtype: datetime
143
- """
144
- return self._pulp_created
145
-
146
- @pulp_created.setter
147
- def pulp_created(self, pulp_created):
148
- """Sets the pulp_created of this RepositoryVersionResponse.
149
-
150
- Timestamp of creation. # noqa: E501
151
-
152
- :param pulp_created: The pulp_created of this RepositoryVersionResponse. # noqa: E501
153
- :type: datetime
154
- """
155
-
156
- self._pulp_created = pulp_created
157
-
158
- @property
159
- def pulp_last_updated(self):
160
- """Gets the pulp_last_updated of this RepositoryVersionResponse. # noqa: E501
161
-
162
- Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same. # noqa: E501
163
-
164
- :return: The pulp_last_updated of this RepositoryVersionResponse. # noqa: E501
165
- :rtype: datetime
166
- """
167
- return self._pulp_last_updated
168
-
169
- @pulp_last_updated.setter
170
- def pulp_last_updated(self, pulp_last_updated):
171
- """Sets the pulp_last_updated of this RepositoryVersionResponse.
172
-
173
- Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same. # noqa: E501
174
-
175
- :param pulp_last_updated: The pulp_last_updated of this RepositoryVersionResponse. # noqa: E501
176
- :type: datetime
177
- """
178
-
179
- self._pulp_last_updated = pulp_last_updated
180
-
181
- @property
182
- def number(self):
183
- """Gets the number of this RepositoryVersionResponse. # noqa: E501
184
-
185
-
186
- :return: The number of this RepositoryVersionResponse. # noqa: E501
187
- :rtype: int
188
- """
189
- return self._number
190
-
191
- @number.setter
192
- def number(self, number):
193
- """Sets the number of this RepositoryVersionResponse.
194
-
195
-
196
- :param number: The number of this RepositoryVersionResponse. # noqa: E501
197
- :type: int
198
- """
199
-
200
- self._number = number
201
-
202
- @property
203
- def repository(self):
204
- """Gets the repository of this RepositoryVersionResponse. # noqa: E501
205
-
206
-
207
- :return: The repository of this RepositoryVersionResponse. # noqa: E501
208
- :rtype: str
209
- """
210
- return self._repository
211
-
212
- @repository.setter
213
- def repository(self, repository):
214
- """Sets the repository of this RepositoryVersionResponse.
215
-
216
-
217
- :param repository: The repository of this RepositoryVersionResponse. # noqa: E501
218
- :type: str
219
- """
220
-
221
- self._repository = repository
222
-
223
- @property
224
- def base_version(self):
225
- """Gets the base_version of this RepositoryVersionResponse. # noqa: E501
226
-
227
- A repository version whose content was used as the initial set of content for this repository version # noqa: E501
228
-
229
- :return: The base_version of this RepositoryVersionResponse. # noqa: E501
230
- :rtype: str
231
- """
232
- return self._base_version
233
-
234
- @base_version.setter
235
- def base_version(self, base_version):
236
- """Sets the base_version of this RepositoryVersionResponse.
237
-
238
- A repository version whose content was used as the initial set of content for this repository version # noqa: E501
239
-
240
- :param base_version: The base_version of this RepositoryVersionResponse. # noqa: E501
241
- :type: str
242
- """
243
-
244
- self._base_version = base_version
245
-
246
- @property
247
- def content_summary(self):
248
- """Gets the content_summary of this RepositoryVersionResponse. # noqa: E501
249
-
250
- Various count summaries of the content in the version and the HREF to view them. # noqa: E501
251
-
252
- :return: The content_summary of this RepositoryVersionResponse. # noqa: E501
253
- :rtype: ContentSummaryResponse
254
- """
255
- return self._content_summary
256
-
257
- @content_summary.setter
258
- def content_summary(self, content_summary):
259
- """Sets the content_summary of this RepositoryVersionResponse.
260
-
261
- Various count summaries of the content in the version and the HREF to view them. # noqa: E501
262
-
263
- :param content_summary: The content_summary of this RepositoryVersionResponse. # noqa: E501
264
- :type: ContentSummaryResponse
265
- """
266
-
267
- self._content_summary = content_summary
268
-
269
- def to_dict(self):
270
- """Returns the model properties as a dict"""
271
- result = {}
272
-
273
- for attr, _ in six.iteritems(self.openapi_types):
274
- value = getattr(self, attr)
275
- if isinstance(value, list):
276
- result[attr] = list(map(
277
- lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
278
- value
279
- ))
280
- elif hasattr(value, "to_dict"):
281
- result[attr] = value.to_dict()
282
- elif isinstance(value, dict):
283
- result[attr] = dict(map(
284
- lambda item: (item[0], item[1].to_dict())
285
- if hasattr(item[1], "to_dict") else item,
286
- value.items()
287
- ))
288
- else:
289
- result[attr] = value
290
-
291
- return result
292
-
293
- def to_str(self):
294
- """Returns the string representation of the model"""
295
- return pprint.pformat(self.to_dict())
296
-
297
- def __repr__(self):
298
- """For `print` and `pprint`"""
299
- return self.to_str()
300
-
301
- def __eq__(self, other):
302
- """Returns true if both objects are equal"""
303
- if not isinstance(other, RepositoryVersionResponse):
304
- return False
305
-
306
- return self.to_dict() == other.to_dict()
30
+ Base serializer for use with [pulpcore.app.models.Model][] This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
31
+ """ # noqa: E501
32
+ pulp_href: Optional[StrictStr] = None
33
+ prn: Optional[StrictStr] = Field(default=None, description="The Pulp Resource Name (PRN).")
34
+ pulp_created: Optional[datetime] = Field(default=None, description="Timestamp of creation.")
35
+ pulp_last_updated: Optional[datetime] = Field(default=None, description="Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.")
36
+ number: Optional[StrictInt] = None
37
+ repository: Optional[StrictStr] = None
38
+ base_version: Optional[StrictStr] = Field(default=None, description="A repository version whose content was used as the initial set of content for this repository version")
39
+ content_summary: Optional[ContentSummaryResponse] = Field(default=None, description="Various count summaries of the content in the version and the HREF to view them.")
40
+ __properties: ClassVar[List[str]] = ["pulp_href", "prn", "pulp_created", "pulp_last_updated", "number", "repository", "base_version", "content_summary"]
41
+
42
+ model_config = ConfigDict(
43
+ populate_by_name=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of RepositoryVersionResponse from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ * OpenAPI `readOnly` fields are excluded.
73
+ * OpenAPI `readOnly` fields are excluded.
74
+ * OpenAPI `readOnly` fields are excluded.
75
+ * OpenAPI `readOnly` fields are excluded.
76
+ * OpenAPI `readOnly` fields are excluded.
77
+ * OpenAPI `readOnly` fields are excluded.
78
+ * OpenAPI `readOnly` fields are excluded.
79
+ """
80
+ excluded_fields: Set[str] = set([
81
+ "pulp_href",
82
+ "prn",
83
+ "pulp_created",
84
+ "pulp_last_updated",
85
+ "number",
86
+ "repository",
87
+ "content_summary",
88
+ ])
89
+
90
+ _dict = self.model_dump(
91
+ by_alias=True,
92
+ exclude=excluded_fields,
93
+ exclude_none=True,
94
+ )
95
+ # override the default output from pydantic by calling `to_dict()` of content_summary
96
+ if self.content_summary:
97
+ _dict['content_summary'] = self.content_summary.to_dict()
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of RepositoryVersionResponse from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate({
110
+ "pulp_href": obj.get("pulp_href"),
111
+ "prn": obj.get("prn"),
112
+ "pulp_created": obj.get("pulp_created"),
113
+ "pulp_last_updated": obj.get("pulp_last_updated"),
114
+ "number": obj.get("number"),
115
+ "repository": obj.get("repository"),
116
+ "base_version": obj.get("base_version"),
117
+ "content_summary": ContentSummaryResponse.from_dict(obj["content_summary"]) if obj.get("content_summary") is not None else None
118
+ })
119
+ return _obj
307
120
 
308
- def __ne__(self, other):
309
- """Returns true if both objects are not equal"""
310
- if not isinstance(other, RepositoryVersionResponse):
311
- return True
312
121
 
313
- return self.to_dict() != other.to_dict()
@@ -3,151 +3,101 @@
3
3
  """
4
4
  Pulp 3 API
5
5
 
6
- Fetch, Upload, Organize, and Distribute Software Packages # noqa: E501
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
7
 
8
8
  The version of the OpenAPI document: v3
9
9
  Contact: pulp-list@redhat.com
10
- Generated by: https://openapi-generator.tech
11
- """
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
12
14
 
13
15
 
16
+ from __future__ import annotations
14
17
  import pprint
15
18
  import re # noqa: F401
19
+ import json
16
20
 
17
- import six
18
-
19
- from pulpcore.client.pulp_python.configuration import Configuration
20
-
21
-
22
- class SetLabel(object):
23
- """NOTE: This class is auto generated by OpenAPI Generator.
24
- Ref: https://openapi-generator.tech
25
-
26
- Do not edit the class manually.
27
- """
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
28
26
 
27
+ class SetLabel(BaseModel):
29
28
  """
30
- Attributes:
31
- openapi_types (dict): The key is attribute name
32
- and the value is attribute type.
33
- attribute_map (dict): The key is attribute name
34
- and the value is json key in definition.
35
- """
36
- openapi_types = {
37
- 'key': 'str',
38
- 'value': 'str'
39
- }
40
-
41
- attribute_map = {
42
- 'key': 'key',
43
- 'value': 'value'
44
- }
45
-
46
- def __init__(self, key=None, value=None, local_vars_configuration=None): # noqa: E501
47
- """SetLabel - a model defined in OpenAPI""" # noqa: E501
48
- if local_vars_configuration is None:
49
- local_vars_configuration = Configuration()
50
- self.local_vars_configuration = local_vars_configuration
51
-
52
- self._key = None
53
- self._value = None
54
- self.discriminator = None
55
-
56
- self.key = key
57
- self.value = value
58
-
59
- @property
60
- def key(self):
61
- """Gets the key of this SetLabel. # noqa: E501
62
-
63
-
64
- :return: The key of this SetLabel. # noqa: E501
65
- :rtype: str
66
- """
67
- return self._key
68
-
69
- @key.setter
70
- def key(self, key):
71
- """Sets the key of this SetLabel.
72
-
73
-
74
- :param key: The key of this SetLabel. # noqa: E501
75
- :type: str
29
+ Serializer for synchronously setting a label.
30
+ """ # noqa: E501
31
+ key: Annotated[str, Field(min_length=1, strict=True)]
32
+ value: Optional[StrictStr]
33
+ __properties: ClassVar[List[str]] = ["key", "value"]
34
+
35
+ @field_validator('key')
36
+ def key_validate_regular_expression(cls, value):
37
+ """Validates the regular expression"""
38
+ if not re.match(r"^[-a-zA-Z0-9_]+$", value):
39
+ raise ValueError(r"must validate the regular expression /^[-a-zA-Z0-9_]+$/")
40
+ return value
41
+
42
+ model_config = ConfigDict(
43
+ populate_by_name=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of SetLabel from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
76
72
  """
77
- if self.local_vars_configuration.client_side_validation and key is None: # noqa: E501
78
- raise ValueError("Invalid value for `key`, must not be `None`") # noqa: E501
79
- if (self.local_vars_configuration.client_side_validation and
80
- key is not None and len(key) < 1):
81
- raise ValueError("Invalid value for `key`, length must be greater than or equal to `1`") # noqa: E501
82
- if (self.local_vars_configuration.client_side_validation and
83
- key is not None and not re.search(r'^[-a-zA-Z0-9_]+$', key)): # noqa: E501
84
- raise ValueError(r"Invalid value for `key`, must be a follow pattern or equal to `/^[-a-zA-Z0-9_]+$/`") # noqa: E501
73
+ excluded_fields: Set[str] = set([
74
+ ])
85
75
 
86
- self._key = key
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # set to None if value (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.value is None and "value" in self.model_fields_set:
84
+ _dict['value'] = None
87
85
 
88
- @property
89
- def value(self):
90
- """Gets the value of this SetLabel. # noqa: E501
86
+ return _dict
91
87
 
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of SetLabel from a dict"""
91
+ if obj is None:
92
+ return None
92
93
 
93
- :return: The value of this SetLabel. # noqa: E501
94
- :rtype: str
95
- """
96
- return self._value
97
-
98
- @value.setter
99
- def value(self, value):
100
- """Sets the value of this SetLabel.
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
101
96
 
97
+ _obj = cls.model_validate({
98
+ "key": obj.get("key"),
99
+ "value": obj.get("value")
100
+ })
101
+ return _obj
102
102
 
103
- :param value: The value of this SetLabel. # noqa: E501
104
- :type: str
105
- """
106
103
 
107
- self._value = value
108
-
109
- def to_dict(self):
110
- """Returns the model properties as a dict"""
111
- result = {}
112
-
113
- for attr, _ in six.iteritems(self.openapi_types):
114
- value = getattr(self, attr)
115
- if isinstance(value, list):
116
- result[attr] = list(map(
117
- lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
118
- value
119
- ))
120
- elif hasattr(value, "to_dict"):
121
- result[attr] = value.to_dict()
122
- elif isinstance(value, dict):
123
- result[attr] = dict(map(
124
- lambda item: (item[0], item[1].to_dict())
125
- if hasattr(item[1], "to_dict") else item,
126
- value.items()
127
- ))
128
- else:
129
- result[attr] = value
130
-
131
- return result
132
-
133
- def to_str(self):
134
- """Returns the string representation of the model"""
135
- return pprint.pformat(self.to_dict())
136
-
137
- def __repr__(self):
138
- """For `print` and `pprint`"""
139
- return self.to_str()
140
-
141
- def __eq__(self, other):
142
- """Returns true if both objects are equal"""
143
- if not isinstance(other, SetLabel):
144
- return False
145
-
146
- return self.to_dict() == other.to_dict()
147
-
148
- def __ne__(self, other):
149
- """Returns true if both objects are not equal"""
150
- if not isinstance(other, SetLabel):
151
- return True
152
-
153
- return self.to_dict() != other.to_dict()