crc-pulp-service-client 20260107.2__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-service-client might be problematic. Click here for more details.

Files changed (41) hide show
  1. crc_pulp_service_client-20260107.2.dist-info/METADATA +2727 -0
  2. crc_pulp_service_client-20260107.2.dist-info/RECORD +41 -0
  3. crc_pulp_service_client-20260107.2.dist-info/WHEEL +5 -0
  4. crc_pulp_service_client-20260107.2.dist-info/top_level.txt +1 -0
  5. pulpcore/__init__.py +2 -0
  6. pulpcore/client/__init__.py +2 -0
  7. pulpcore/client/pulp_service/__init__.py +59 -0
  8. pulpcore/client/pulp_service/api/__init__.py +13 -0
  9. pulpcore/client/pulp_service/api/api_create_domain_api.py +335 -0
  10. pulpcore/client/pulp_service/api/api_debug_auth_header_api.py +329 -0
  11. pulpcore/client/pulp_service/api/api_debug_database_triggers_api.py +329 -0
  12. pulpcore/client/pulp_service/api/api_rds_connection_tests_api.py +591 -0
  13. pulpcore/client/pulp_service/api/api_test_random_lock_tasks_api.py +326 -0
  14. pulpcore/client/pulp_service/api/api_test_tasks_api.py +326 -0
  15. pulpcore/client/pulp_service/api/contentguards_feature_api.py +3401 -0
  16. pulpcore/client/pulp_service/api/tasks_api.py +1469 -0
  17. pulpcore/client/pulp_service/api/vuln_report_service_api.py +1301 -0
  18. pulpcore/client/pulp_service/api_client.py +798 -0
  19. pulpcore/client/pulp_service/api_response.py +21 -0
  20. pulpcore/client/pulp_service/configuration.py +628 -0
  21. pulpcore/client/pulp_service/exceptions.py +200 -0
  22. pulpcore/client/pulp_service/models/__init__.py +34 -0
  23. pulpcore/client/pulp_service/models/async_operation_response.py +88 -0
  24. pulpcore/client/pulp_service/models/domain.py +114 -0
  25. pulpcore/client/pulp_service/models/domain_response.py +131 -0
  26. pulpcore/client/pulp_service/models/my_permissions_response.py +88 -0
  27. pulpcore/client/pulp_service/models/nested_role.py +93 -0
  28. pulpcore/client/pulp_service/models/nested_role_response.py +92 -0
  29. pulpcore/client/pulp_service/models/object_roles_response.py +96 -0
  30. pulpcore/client/pulp_service/models/paginated_task_response_list.py +112 -0
  31. pulpcore/client/pulp_service/models/paginatedservice_feature_content_guard_response_list.py +112 -0
  32. pulpcore/client/pulp_service/models/paginatedservice_vulnerability_report_response_list.py +112 -0
  33. pulpcore/client/pulp_service/models/patchedservice_feature_content_guard.py +107 -0
  34. pulpcore/client/pulp_service/models/progress_report_response.py +115 -0
  35. pulpcore/client/pulp_service/models/service_feature_content_guard.py +107 -0
  36. pulpcore/client/pulp_service/models/service_feature_content_guard_response.py +123 -0
  37. pulpcore/client/pulp_service/models/service_vulnerability_report_response.py +110 -0
  38. pulpcore/client/pulp_service/models/storage_class_enum.py +40 -0
  39. pulpcore/client/pulp_service/models/task_response.py +186 -0
  40. pulpcore/client/pulp_service/py.typed +0 -0
  41. pulpcore/client/pulp_service/rest.py +258 -0
@@ -0,0 +1,200 @@
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
@@ -0,0 +1,34 @@
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 pulpcore.client.pulp_service.models.async_operation_response import AsyncOperationResponse
19
+ from pulpcore.client.pulp_service.models.domain import Domain
20
+ from pulpcore.client.pulp_service.models.domain_response import DomainResponse
21
+ from pulpcore.client.pulp_service.models.my_permissions_response import MyPermissionsResponse
22
+ from pulpcore.client.pulp_service.models.nested_role import NestedRole
23
+ from pulpcore.client.pulp_service.models.nested_role_response import NestedRoleResponse
24
+ from pulpcore.client.pulp_service.models.object_roles_response import ObjectRolesResponse
25
+ from pulpcore.client.pulp_service.models.paginated_task_response_list import PaginatedTaskResponseList
26
+ from pulpcore.client.pulp_service.models.paginatedservice_feature_content_guard_response_list import PaginatedserviceFeatureContentGuardResponseList
27
+ from pulpcore.client.pulp_service.models.paginatedservice_vulnerability_report_response_list import PaginatedserviceVulnerabilityReportResponseList
28
+ from pulpcore.client.pulp_service.models.patchedservice_feature_content_guard import PatchedserviceFeatureContentGuard
29
+ from pulpcore.client.pulp_service.models.progress_report_response import ProgressReportResponse
30
+ from pulpcore.client.pulp_service.models.service_feature_content_guard import ServiceFeatureContentGuard
31
+ from pulpcore.client.pulp_service.models.service_feature_content_guard_response import ServiceFeatureContentGuardResponse
32
+ from pulpcore.client.pulp_service.models.service_vulnerability_report_response import ServiceVulnerabilityReportResponse
33
+ from pulpcore.client.pulp_service.models.storage_class_enum import StorageClassEnum
34
+ from pulpcore.client.pulp_service.models.task_response import TaskResponse
@@ -0,0 +1,88 @@
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
+
@@ -0,0 +1,114 @@
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, StrictBool, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from pulpcore.client.pulp_service.models.storage_class_enum import StorageClassEnum
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class Domain(BaseModel):
29
+ """
30
+ Serializer for Domain.
31
+ """ # noqa: E501
32
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=50)] = Field(description="A name for this domain.")
33
+ description: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, description="An optional description.")
34
+ pulp_labels: Optional[Dict[str, Optional[StrictStr]]] = None
35
+ storage_class: StorageClassEnum = Field(description="Backend storage class for domain. * `pulpcore.app.models.storage.FileSystem` - Use local filesystem as storage * `storages.backends.s3boto3.S3Boto3Storage` - Use Amazon S3 as storage * `storages.backends.azure_storage.AzureStorage` - Use Azure Blob as storage * `pulp_service.app.storage.OCIStorage` - Use OCI as storage")
36
+ storage_settings: Dict[str, Any] = Field(description="Settings for storage class.")
37
+ redirect_to_object_storage: Optional[StrictBool] = Field(default=True, description="Boolean to have the content app redirect to object storage.")
38
+ hide_guarded_distributions: Optional[StrictBool] = Field(default=False, description="Boolean to hide distributions with a content guard in the content app.")
39
+ __properties: ClassVar[List[str]] = ["name", "description", "pulp_labels", "storage_class", "storage_settings", "redirect_to_object_storage", "hide_guarded_distributions"]
40
+
41
+ @field_validator('name')
42
+ def name_validate_regular_expression(cls, value):
43
+ """Validates the regular expression"""
44
+ if not re.match(r"^[-a-zA-Z0-9_]+$", value):
45
+ raise ValueError(r"must validate the regular expression /^[-a-zA-Z0-9_]+$/")
46
+ return value
47
+
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+
55
+ def to_str(self) -> str:
56
+ """Returns the string representation of the model using alias"""
57
+ return pprint.pformat(self.model_dump(by_alias=True))
58
+
59
+ def to_json(self) -> str:
60
+ """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())
63
+
64
+ @classmethod
65
+ def from_json(cls, json_str: str) -> Optional[Self]:
66
+ """Create an instance of Domain from a JSON string"""
67
+ return cls.from_dict(json.loads(json_str))
68
+
69
+ def to_dict(self) -> Dict[str, Any]:
70
+ """Return the dictionary representation of the model using alias.
71
+
72
+ This has the following differences from calling pydantic's
73
+ `self.model_dump(by_alias=True)`:
74
+
75
+ * `None` is only added to the output dict for nullable fields that
76
+ were set at model initialization. Other fields with value `None`
77
+ are ignored.
78
+ """
79
+ excluded_fields: Set[str] = set([
80
+ ])
81
+
82
+ _dict = self.model_dump(
83
+ by_alias=True,
84
+ exclude=excluded_fields,
85
+ exclude_none=True,
86
+ )
87
+ # set to None if description (nullable) is None
88
+ # and model_fields_set contains the field
89
+ if self.description is None and "description" in self.model_fields_set:
90
+ _dict['description'] = None
91
+
92
+ return _dict
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
96
+ """Create an instance of Domain from a dict"""
97
+ if obj is None:
98
+ return None
99
+
100
+ if not isinstance(obj, dict):
101
+ return cls.model_validate(obj)
102
+
103
+ _obj = cls.model_validate({
104
+ "name": obj.get("name"),
105
+ "description": obj.get("description"),
106
+ "pulp_labels": obj.get("pulp_labels"),
107
+ "storage_class": obj.get("storage_class"),
108
+ "storage_settings": obj.get("storage_settings"),
109
+ "redirect_to_object_storage": obj.get("redirect_to_object_storage") if obj.get("redirect_to_object_storage") is not None else True,
110
+ "hide_guarded_distributions": obj.get("hide_guarded_distributions") if obj.get("hide_guarded_distributions") is not None else False
111
+ })
112
+ return _obj
113
+
114
+
@@ -0,0 +1,131 @@
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 datetime import datetime
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from typing_extensions import Annotated
25
+ from pulpcore.client.pulp_service.models.storage_class_enum import StorageClassEnum
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+
29
+ class DomainResponse(BaseModel):
30
+ """
31
+ Serializer for Domain.
32
+ """ # noqa: E501
33
+ pulp_href: Optional[StrictStr] = None
34
+ prn: Optional[StrictStr] = Field(default=None, description="The Pulp Resource Name (PRN).")
35
+ pulp_created: Optional[datetime] = Field(default=None, description="Timestamp of creation.")
36
+ 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.")
37
+ name: Annotated[str, Field(strict=True, max_length=50)] = Field(description="A name for this domain.")
38
+ description: Optional[StrictStr] = Field(default=None, description="An optional description.")
39
+ pulp_labels: Optional[Dict[str, Optional[StrictStr]]] = None
40
+ storage_class: StorageClassEnum = Field(description="Backend storage class for domain. * `pulpcore.app.models.storage.FileSystem` - Use local filesystem as storage * `storages.backends.s3boto3.S3Boto3Storage` - Use Amazon S3 as storage * `storages.backends.azure_storage.AzureStorage` - Use Azure Blob as storage * `pulp_service.app.storage.OCIStorage` - Use OCI as storage")
41
+ storage_settings: Dict[str, Any] = Field(description="Settings for storage class.")
42
+ redirect_to_object_storage: Optional[StrictBool] = Field(default=True, description="Boolean to have the content app redirect to object storage.")
43
+ hide_guarded_distributions: Optional[StrictBool] = Field(default=False, description="Boolean to hide distributions with a content guard in the content app.")
44
+ __properties: ClassVar[List[str]] = ["pulp_href", "prn", "pulp_created", "pulp_last_updated", "name", "description", "pulp_labels", "storage_class", "storage_settings", "redirect_to_object_storage", "hide_guarded_distributions"]
45
+
46
+ @field_validator('name')
47
+ def name_validate_regular_expression(cls, value):
48
+ """Validates the regular expression"""
49
+ if not re.match(r"^[-a-zA-Z0-9_]+$", value):
50
+ raise ValueError(r"must validate the regular expression /^[-a-zA-Z0-9_]+$/")
51
+ return value
52
+
53
+ model_config = ConfigDict(
54
+ populate_by_name=True,
55
+ validate_assignment=True,
56
+ protected_namespaces=(),
57
+ )
58
+
59
+
60
+ def to_str(self) -> str:
61
+ """Returns the string representation of the model using alias"""
62
+ return pprint.pformat(self.model_dump(by_alias=True))
63
+
64
+ def to_json(self) -> str:
65
+ """Returns the JSON representation of the model using alias"""
66
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
+ return json.dumps(self.to_dict())
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of DomainResponse from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ * OpenAPI `readOnly` fields are excluded.
84
+ * OpenAPI `readOnly` fields are excluded.
85
+ * OpenAPI `readOnly` fields are excluded.
86
+ * OpenAPI `readOnly` fields are excluded.
87
+ """
88
+ excluded_fields: Set[str] = set([
89
+ "pulp_href",
90
+ "prn",
91
+ "pulp_created",
92
+ "pulp_last_updated",
93
+ ])
94
+
95
+ _dict = self.model_dump(
96
+ by_alias=True,
97
+ exclude=excluded_fields,
98
+ exclude_none=True,
99
+ )
100
+ # set to None if description (nullable) is None
101
+ # and model_fields_set contains the field
102
+ if self.description is None and "description" in self.model_fields_set:
103
+ _dict['description'] = None
104
+
105
+ return _dict
106
+
107
+ @classmethod
108
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
109
+ """Create an instance of DomainResponse from a dict"""
110
+ if obj is None:
111
+ return None
112
+
113
+ if not isinstance(obj, dict):
114
+ return cls.model_validate(obj)
115
+
116
+ _obj = cls.model_validate({
117
+ "pulp_href": obj.get("pulp_href"),
118
+ "prn": obj.get("prn"),
119
+ "pulp_created": obj.get("pulp_created"),
120
+ "pulp_last_updated": obj.get("pulp_last_updated"),
121
+ "name": obj.get("name"),
122
+ "description": obj.get("description"),
123
+ "pulp_labels": obj.get("pulp_labels"),
124
+ "storage_class": obj.get("storage_class"),
125
+ "storage_settings": obj.get("storage_settings"),
126
+ "redirect_to_object_storage": obj.get("redirect_to_object_storage") if obj.get("redirect_to_object_storage") is not None else True,
127
+ "hide_guarded_distributions": obj.get("hide_guarded_distributions") if obj.get("hide_guarded_distributions") is not None else False
128
+ })
129
+ return _obj
130
+
131
+
@@ -0,0 +1,88 @@
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
+