crc-pulp-python-client 20250819.1__py3-none-any.whl → 20250821.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 crc-pulp-python-client might be problematic. Click here for more details.

Files changed (74) hide show
  1. crc-pulp_python-client/api/__init__.py +3 -3
  2. crc-pulp_python-client/api/content_packages_api.py +261 -201
  3. crc-pulp_python-client/api/{api_pypi_api.py → pypi_api.py} +2 -2
  4. crc-pulp_python-client/api/{api_pypi_legacy_api.py → pypi_legacy_api.py} +2 -2
  5. crc-pulp_python-client/api/pypi_metadata_api.py +1 -1
  6. crc-pulp_python-client/api/{api_pypi_simple_api.py → pypi_simple_api.py} +4 -4
  7. crc-pulp_python-client/api/repositories_python_api.py +279 -0
  8. crc-pulp_python-client/api_client.py +1 -1
  9. crc-pulp_python-client/configuration.py +3 -3
  10. crc-pulp_python-client/models/python_python_package_content_response.py +80 -53
  11. {crc_pulp_python_client-20250819.1.dist-info → crc_pulp_python_client-20250821.1.dist-info}/METADATA +1 -1
  12. crc_pulp_python_client-20250821.1.dist-info/RECORD +62 -0
  13. crc_pulp_python_client-20250821.1.dist-info/top_level.txt +1 -0
  14. crc_pulp_python_client-20250819.1.dist-info/RECORD +0 -120
  15. crc_pulp_python_client-20250819.1.dist-info/top_level.txt +0 -2
  16. services-pulp_python-client/__init__.py +0 -2
  17. services-pulp_python-client/api/__init__.py +0 -14
  18. services-pulp_python-client/api/api_pypi_api.py +0 -370
  19. services-pulp_python-client/api/api_pypi_legacy_api.py +0 -393
  20. services-pulp_python-client/api/api_pypi_simple_api.py +0 -1045
  21. services-pulp_python-client/api/content_packages_api.py +0 -2594
  22. services-pulp_python-client/api/distributions_pypi_api.py +0 -4186
  23. services-pulp_python-client/api/publications_pypi_api.py +0 -2881
  24. services-pulp_python-client/api/pypi_metadata_api.py +0 -385
  25. services-pulp_python-client/api/remotes_python_api.py +0 -4552
  26. services-pulp_python-client/api/repositories_python_api.py +0 -4856
  27. services-pulp_python-client/api/repositories_python_versions_api.py +0 -1670
  28. services-pulp_python-client/api_client.py +0 -798
  29. services-pulp_python-client/api_response.py +0 -21
  30. services-pulp_python-client/configuration.py +0 -628
  31. services-pulp_python-client/exceptions.py +0 -200
  32. services-pulp_python-client/models/__init__.py +0 -56
  33. services-pulp_python-client/models/async_operation_response.py +0 -88
  34. services-pulp_python-client/models/content_summary_response.py +0 -92
  35. services-pulp_python-client/models/exclude_platforms_enum.py +0 -40
  36. services-pulp_python-client/models/my_permissions_response.py +0 -88
  37. services-pulp_python-client/models/nested_role.py +0 -93
  38. services-pulp_python-client/models/nested_role_response.py +0 -92
  39. services-pulp_python-client/models/object_roles_response.py +0 -96
  40. services-pulp_python-client/models/package_metadata_response.py +0 -109
  41. services-pulp_python-client/models/package_types_enum.py +0 -44
  42. services-pulp_python-client/models/package_upload_task_response.py +0 -103
  43. services-pulp_python-client/models/paginated_repository_version_response_list.py +0 -112
  44. services-pulp_python-client/models/paginatedpython_python_distribution_response_list.py +0 -112
  45. services-pulp_python-client/models/paginatedpython_python_package_content_response_list.py +0 -112
  46. services-pulp_python-client/models/paginatedpython_python_publication_response_list.py +0 -112
  47. services-pulp_python-client/models/paginatedpython_python_remote_response_list.py +0 -112
  48. services-pulp_python-client/models/paginatedpython_python_repository_response_list.py +0 -112
  49. services-pulp_python-client/models/patchedpython_python_distribution.py +0 -125
  50. services-pulp_python-client/models/patchedpython_python_remote.py +0 -219
  51. services-pulp_python-client/models/patchedpython_python_repository.py +0 -114
  52. services-pulp_python-client/models/policy_enum.py +0 -39
  53. services-pulp_python-client/models/python_python_distribution.py +0 -125
  54. services-pulp_python-client/models/python_python_distribution_response.py +0 -149
  55. services-pulp_python-client/models/python_python_package_content_response.py +0 -201
  56. services-pulp_python-client/models/python_python_publication.py +0 -90
  57. services-pulp_python-client/models/python_python_publication_response.py +0 -111
  58. services-pulp_python-client/models/python_python_remote.py +0 -219
  59. services-pulp_python-client/models/python_python_remote_response.py +0 -213
  60. services-pulp_python-client/models/python_python_remote_response_hidden_fields_inner.py +0 -90
  61. services-pulp_python-client/models/python_python_repository.py +0 -114
  62. services-pulp_python-client/models/python_python_repository_response.py +0 -139
  63. services-pulp_python-client/models/repair.py +0 -88
  64. services-pulp_python-client/models/repository_add_remove_content.py +0 -93
  65. services-pulp_python-client/models/repository_sync_url.py +0 -90
  66. services-pulp_python-client/models/repository_version_response.py +0 -121
  67. services-pulp_python-client/models/set_label.py +0 -103
  68. services-pulp_python-client/models/set_label_response.py +0 -103
  69. services-pulp_python-client/models/summary_response.py +0 -92
  70. services-pulp_python-client/models/unset_label.py +0 -96
  71. services-pulp_python-client/models/unset_label_response.py +0 -100
  72. services-pulp_python-client/py.typed +0 -0
  73. services-pulp_python-client/rest.py +0 -258
  74. {crc_pulp_python_client-20250819.1.dist-info → crc_pulp_python_client-20250821.1.dist-info}/WHEEL +0 -0
@@ -1,200 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
- from typing import Any, Optional
16
- from typing_extensions import Self
17
-
18
- class OpenApiException(Exception):
19
- """The base exception class for all OpenAPIExceptions"""
20
-
21
-
22
- class ApiTypeError(OpenApiException, TypeError):
23
- def __init__(self, msg, path_to_item=None, valid_classes=None,
24
- 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:
131
- pass
132
- self.headers = http_resp.getheaders()
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
- if 500 <= http_resp.status <= 599:
155
- raise ServiceException(http_resp=http_resp, body=body, data=data)
156
- raise ApiException(http_resp=http_resp, body=body, data=data)
157
-
158
- def __str__(self):
159
- """Custom error messages for exception"""
160
- error_message = "({0})\n"\
161
- "Reason: {1}\n".format(self.status, self.reason)
162
- if self.headers:
163
- error_message += "HTTP response headers: {0}\n".format(
164
- self.headers)
165
-
166
- if self.data or self.body:
167
- error_message += "HTTP response body: {0}\n".format(self.data or self.body)
168
-
169
- return error_message
170
-
171
-
172
- class BadRequestException(ApiException):
173
- pass
174
-
175
-
176
- class NotFoundException(ApiException):
177
- pass
178
-
179
-
180
- class UnauthorizedException(ApiException):
181
- pass
182
-
183
-
184
- class ForbiddenException(ApiException):
185
- pass
186
-
187
-
188
- class ServiceException(ApiException):
189
- pass
190
-
191
-
192
- def render_path(path_to_item):
193
- """Returns a string representation of a path"""
194
- result = ""
195
- for pth in path_to_item:
196
- if isinstance(pth, int):
197
- result += "[{0}]".format(pth)
198
- else:
199
- result += "['{0}']".format(pth)
200
- return result
@@ -1,56 +0,0 @@
1
- # coding: utf-8
2
-
3
- # flake8: noqa
4
- """
5
- Pulp 3 API
6
-
7
- Fetch, Upload, Organize, and Distribute Software Packages
8
-
9
- The version of the OpenAPI document: v3
10
- Contact: pulp-list@redhat.com
11
- Generated by OpenAPI Generator (https://openapi-generator.tech)
12
-
13
- Do not edit the class manually.
14
- """ # noqa: E501
15
-
16
-
17
- # import models into model package
18
- from services-pulp_python-client.models.async_operation_response import AsyncOperationResponse
19
- from services-pulp_python-client.models.content_summary_response import ContentSummaryResponse
20
- from services-pulp_python-client.models.exclude_platforms_enum import ExcludePlatformsEnum
21
- from services-pulp_python-client.models.my_permissions_response import MyPermissionsResponse
22
- from services-pulp_python-client.models.nested_role import NestedRole
23
- from services-pulp_python-client.models.nested_role_response import NestedRoleResponse
24
- from services-pulp_python-client.models.object_roles_response import ObjectRolesResponse
25
- from services-pulp_python-client.models.package_metadata_response import PackageMetadataResponse
26
- from services-pulp_python-client.models.package_types_enum import PackageTypesEnum
27
- from services-pulp_python-client.models.package_upload_task_response import PackageUploadTaskResponse
28
- from services-pulp_python-client.models.paginated_repository_version_response_list import PaginatedRepositoryVersionResponseList
29
- from services-pulp_python-client.models.paginatedpython_python_distribution_response_list import PaginatedpythonPythonDistributionResponseList
30
- from services-pulp_python-client.models.paginatedpython_python_package_content_response_list import PaginatedpythonPythonPackageContentResponseList
31
- from services-pulp_python-client.models.paginatedpython_python_publication_response_list import PaginatedpythonPythonPublicationResponseList
32
- from services-pulp_python-client.models.paginatedpython_python_remote_response_list import PaginatedpythonPythonRemoteResponseList
33
- from services-pulp_python-client.models.paginatedpython_python_repository_response_list import PaginatedpythonPythonRepositoryResponseList
34
- from services-pulp_python-client.models.patchedpython_python_distribution import PatchedpythonPythonDistribution
35
- from services-pulp_python-client.models.patchedpython_python_remote import PatchedpythonPythonRemote
36
- from services-pulp_python-client.models.patchedpython_python_repository import PatchedpythonPythonRepository
37
- from services-pulp_python-client.models.policy_enum import PolicyEnum
38
- from services-pulp_python-client.models.python_python_distribution import PythonPythonDistribution
39
- from services-pulp_python-client.models.python_python_distribution_response import PythonPythonDistributionResponse
40
- from services-pulp_python-client.models.python_python_package_content_response import PythonPythonPackageContentResponse
41
- from services-pulp_python-client.models.python_python_publication import PythonPythonPublication
42
- from services-pulp_python-client.models.python_python_publication_response import PythonPythonPublicationResponse
43
- from services-pulp_python-client.models.python_python_remote import PythonPythonRemote
44
- from services-pulp_python-client.models.python_python_remote_response import PythonPythonRemoteResponse
45
- from services-pulp_python-client.models.python_python_remote_response_hidden_fields_inner import PythonPythonRemoteResponseHiddenFieldsInner
46
- from services-pulp_python-client.models.python_python_repository import PythonPythonRepository
47
- from services-pulp_python-client.models.python_python_repository_response import PythonPythonRepositoryResponse
48
- from services-pulp_python-client.models.repair import Repair
49
- from services-pulp_python-client.models.repository_add_remove_content import RepositoryAddRemoveContent
50
- from services-pulp_python-client.models.repository_sync_url import RepositorySyncURL
51
- from services-pulp_python-client.models.repository_version_response import RepositoryVersionResponse
52
- from services-pulp_python-client.models.set_label import SetLabel
53
- from services-pulp_python-client.models.set_label_response import SetLabelResponse
54
- from services-pulp_python-client.models.summary_response import SummaryResponse
55
- from services-pulp_python-client.models.unset_label import UnsetLabel
56
- from services-pulp_python-client.models.unset_label_response import UnsetLabelResponse
@@ -1,88 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
- from typing import Any, ClassVar, Dict, List
23
- from typing import Optional, Set
24
- from typing_extensions import Self
25
-
26
- class AsyncOperationResponse(BaseModel):
27
- """
28
- Serializer for asynchronous operations.
29
- """ # noqa: E501
30
- task: StrictStr = Field(description="The href of the task.")
31
- __properties: ClassVar[List[str]] = ["task"]
32
-
33
- model_config = ConfigDict(
34
- populate_by_name=True,
35
- validate_assignment=True,
36
- protected_namespaces=(),
37
- )
38
-
39
-
40
- def to_str(self) -> str:
41
- """Returns the string representation of the model using alias"""
42
- return pprint.pformat(self.model_dump(by_alias=True))
43
-
44
- def to_json(self) -> str:
45
- """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
-
49
- @classmethod
50
- def from_json(cls, json_str: str) -> Optional[Self]:
51
- """Create an instance of AsyncOperationResponse from a JSON string"""
52
- return cls.from_dict(json.loads(json_str))
53
-
54
- def to_dict(self) -> Dict[str, Any]:
55
- """Return the dictionary representation of the model using alias.
56
-
57
- This has the following differences from calling pydantic's
58
- `self.model_dump(by_alias=True)`:
59
-
60
- * `None` is only added to the output dict for nullable fields that
61
- were set at model initialization. Other fields with value `None`
62
- are ignored.
63
- """
64
- excluded_fields: Set[str] = set([
65
- ])
66
-
67
- _dict = self.model_dump(
68
- by_alias=True,
69
- exclude=excluded_fields,
70
- exclude_none=True,
71
- )
72
- return _dict
73
-
74
- @classmethod
75
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
- """Create an instance of AsyncOperationResponse from a dict"""
77
- if obj is None:
78
- return None
79
-
80
- if not isinstance(obj, dict):
81
- return cls.model_validate(obj)
82
-
83
- _obj = cls.model_validate({
84
- "task": obj.get("task")
85
- })
86
- return _obj
87
-
88
-
@@ -1,92 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict
22
- from typing import Any, ClassVar, Dict, List
23
- from typing import Optional, Set
24
- from typing_extensions import Self
25
-
26
- class ContentSummaryResponse(BaseModel):
27
- """
28
- Serializer for the RepositoryVersion content summary
29
- """ # noqa: E501
30
- added: Dict[str, Dict[str, Any]]
31
- removed: Dict[str, Dict[str, Any]]
32
- present: Dict[str, Dict[str, Any]]
33
- __properties: ClassVar[List[str]] = ["added", "removed", "present"]
34
-
35
- model_config = ConfigDict(
36
- populate_by_name=True,
37
- validate_assignment=True,
38
- protected_namespaces=(),
39
- )
40
-
41
-
42
- def to_str(self) -> str:
43
- """Returns the string representation of the model using alias"""
44
- return pprint.pformat(self.model_dump(by_alias=True))
45
-
46
- def to_json(self) -> str:
47
- """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
-
51
- @classmethod
52
- def from_json(cls, json_str: str) -> Optional[Self]:
53
- """Create an instance of ContentSummaryResponse from a JSON string"""
54
- return cls.from_dict(json.loads(json_str))
55
-
56
- def to_dict(self) -> Dict[str, Any]:
57
- """Return the dictionary representation of the model using alias.
58
-
59
- This has the following differences from calling pydantic's
60
- `self.model_dump(by_alias=True)`:
61
-
62
- * `None` is only added to the output dict for nullable fields that
63
- were set at model initialization. Other fields with value `None`
64
- are ignored.
65
- """
66
- excluded_fields: Set[str] = set([
67
- ])
68
-
69
- _dict = self.model_dump(
70
- by_alias=True,
71
- exclude=excluded_fields,
72
- exclude_none=True,
73
- )
74
- return _dict
75
-
76
- @classmethod
77
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
- """Create an instance of ContentSummaryResponse from a dict"""
79
- if obj is None:
80
- return None
81
-
82
- if not isinstance(obj, dict):
83
- return cls.model_validate(obj)
84
-
85
- _obj = cls.model_validate({
86
- "added": obj.get("added"),
87
- "removed": obj.get("removed"),
88
- "present": obj.get("present")
89
- })
90
- return _obj
91
-
92
-
@@ -1,40 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import json
18
- from enum import Enum
19
- from typing_extensions import Self
20
-
21
-
22
- class ExcludePlatformsEnum(str, Enum):
23
- """
24
- * `windows` - windows * `macos` - macos * `freebsd` - freebsd * `linux` - linux
25
- """
26
-
27
- """
28
- allowed enum values
29
- """
30
- WINDOWS = 'windows'
31
- MACOS = 'macos'
32
- FREEBSD = 'freebsd'
33
- LINUX = 'linux'
34
-
35
- @classmethod
36
- def from_json(cls, json_str: str) -> Self:
37
- """Create an instance of ExcludePlatformsEnum from a JSON string"""
38
- return cls(json.loads(json_str))
39
-
40
-
@@ -1,88 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, StrictStr
22
- from typing import Any, ClassVar, Dict, List
23
- from typing import Optional, Set
24
- from typing_extensions import Self
25
-
26
- class MyPermissionsResponse(BaseModel):
27
- """
28
- MyPermissionsResponse
29
- """ # noqa: E501
30
- permissions: List[StrictStr]
31
- __properties: ClassVar[List[str]] = ["permissions"]
32
-
33
- model_config = ConfigDict(
34
- populate_by_name=True,
35
- validate_assignment=True,
36
- protected_namespaces=(),
37
- )
38
-
39
-
40
- def to_str(self) -> str:
41
- """Returns the string representation of the model using alias"""
42
- return pprint.pformat(self.model_dump(by_alias=True))
43
-
44
- def to_json(self) -> str:
45
- """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
-
49
- @classmethod
50
- def from_json(cls, json_str: str) -> Optional[Self]:
51
- """Create an instance of MyPermissionsResponse from a JSON string"""
52
- return cls.from_dict(json.loads(json_str))
53
-
54
- def to_dict(self) -> Dict[str, Any]:
55
- """Return the dictionary representation of the model using alias.
56
-
57
- This has the following differences from calling pydantic's
58
- `self.model_dump(by_alias=True)`:
59
-
60
- * `None` is only added to the output dict for nullable fields that
61
- were set at model initialization. Other fields with value `None`
62
- are ignored.
63
- """
64
- excluded_fields: Set[str] = set([
65
- ])
66
-
67
- _dict = self.model_dump(
68
- by_alias=True,
69
- exclude=excluded_fields,
70
- exclude_none=True,
71
- )
72
- return _dict
73
-
74
- @classmethod
75
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
- """Create an instance of MyPermissionsResponse from a dict"""
77
- if obj is None:
78
- return None
79
-
80
- if not isinstance(obj, dict):
81
- return cls.model_validate(obj)
82
-
83
- _obj = cls.model_validate({
84
- "permissions": obj.get("permissions")
85
- })
86
- return _obj
87
-
88
-
@@ -1,93 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, Field
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
26
-
27
- class NestedRole(BaseModel):
28
- """
29
- Serializer to add/remove object roles to/from users/groups. This is used in conjunction with ``pulpcore.app.viewsets.base.RolesMixin`` and requires the underlying object to be passed as ``content_object`` in the context.
30
- """ # noqa: E501
31
- users: Optional[List[Annotated[str, Field(min_length=1, strict=True)]]] = None
32
- groups: Optional[List[Annotated[str, Field(min_length=1, strict=True)]]] = None
33
- role: Annotated[str, Field(min_length=1, strict=True)]
34
- __properties: ClassVar[List[str]] = ["users", "groups", "role"]
35
-
36
- model_config = ConfigDict(
37
- populate_by_name=True,
38
- validate_assignment=True,
39
- protected_namespaces=(),
40
- )
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 NestedRole 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
-
70
- _dict = self.model_dump(
71
- by_alias=True,
72
- exclude=excluded_fields,
73
- exclude_none=True,
74
- )
75
- return _dict
76
-
77
- @classmethod
78
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
- """Create an instance of NestedRole from a dict"""
80
- if obj is None:
81
- return None
82
-
83
- if not isinstance(obj, dict):
84
- return cls.model_validate(obj)
85
-
86
- _obj = cls.model_validate({
87
- "users": obj.get("users"),
88
- "groups": obj.get("groups"),
89
- "role": obj.get("role")
90
- })
91
- return _obj
92
-
93
-