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.
- pulp_python_client-3.13.1.dist-info/METADATA +17 -0
- pulp_python_client-3.13.1.dist-info/RECORD +64 -0
- {pulp_python_client-3.12.5.dist-info → pulp_python_client-3.13.1.dist-info}/WHEEL +1 -1
- pulpcore/client/pulp_python/__init__.py +9 -10
- pulpcore/client/pulp_python/api/__init__.py +1 -2
- pulpcore/client/pulp_python/api/content_packages_api.py +1800 -655
- pulpcore/client/pulp_python/api/distributions_pypi_api.py +3755 -1474
- pulpcore/client/pulp_python/api/publications_pypi_api.py +2574 -982
- pulpcore/client/pulp_python/api/pypi_api.py +302 -128
- pulpcore/client/pulp_python/api/pypi_legacy_api.py +326 -153
- pulpcore/client/pulp_python/api/pypi_metadata_api.py +319 -139
- pulpcore/client/pulp_python/api/pypi_simple_api.py +899 -382
- pulpcore/client/pulp_python/api/remotes_python_api.py +4092 -1589
- pulpcore/client/pulp_python/api/repositories_python_api.py +4380 -1719
- pulpcore/client/pulp_python/api/repositories_python_versions_api.py +1526 -561
- pulpcore/client/pulp_python/api_client.py +444 -313
- pulpcore/client/pulp_python/api_response.py +21 -0
- pulpcore/client/pulp_python/configuration.py +266 -73
- pulpcore/client/pulp_python/exceptions.py +99 -20
- pulpcore/client/pulp_python/models/__init__.py +5 -8
- pulpcore/client/pulp_python/models/async_operation_response.py +60 -96
- pulpcore/client/pulp_python/models/content_summary_response.py +70 -154
- pulpcore/client/pulp_python/models/exclude_platforms_enum.py +19 -82
- pulpcore/client/pulp_python/models/my_permissions_response.py +60 -94
- pulpcore/client/pulp_python/models/nested_role.py +71 -155
- pulpcore/client/pulp_python/models/nested_role_response.py +70 -152
- pulpcore/client/pulp_python/models/object_roles_response.py +70 -96
- pulpcore/client/pulp_python/models/package_metadata_response.py +91 -191
- pulpcore/client/pulp_python/models/package_types_enum.py +23 -86
- pulpcore/client/pulp_python/models/package_upload_task_response.py +85 -154
- pulpcore/client/pulp_python/models/paginated_repository_version_response_list.py +94 -181
- pulpcore/client/pulp_python/models/paginatedpython_python_distribution_response_list.py +94 -181
- pulpcore/client/pulp_python/models/paginatedpython_python_package_content_response_list.py +94 -181
- pulpcore/client/pulp_python/models/paginatedpython_python_publication_response_list.py +94 -181
- pulpcore/client/pulp_python/models/paginatedpython_python_remote_response_list.py +94 -181
- pulpcore/client/pulp_python/models/paginatedpython_python_repository_response_list.py +94 -181
- pulpcore/client/pulp_python/models/patchedpython_python_distribution.py +108 -330
- pulpcore/client/pulp_python/models/patchedpython_python_remote.py +204 -864
- pulpcore/client/pulp_python/models/patchedpython_python_repository.py +96 -249
- pulpcore/client/pulp_python/models/policy_enum.py +18 -81
- pulpcore/client/pulp_python/models/python_python_distribution.py +108 -332
- pulpcore/client/pulp_python/models/python_python_distribution_response.py +132 -490
- pulpcore/client/pulp_python/models/python_python_package_content_response.py +182 -972
- pulpcore/client/pulp_python/models/python_python_publication.py +68 -127
- pulpcore/client/pulp_python/models/python_python_publication_response.py +93 -269
- pulpcore/client/pulp_python/models/python_python_remote.py +204 -866
- pulpcore/client/pulp_python/models/python_python_remote_response.py +198 -839
- pulpcore/client/pulp_python/models/python_python_remote_response_hidden_fields_inner.py +90 -0
- pulpcore/client/pulp_python/models/python_python_repository.py +96 -250
- pulpcore/client/pulp_python/models/python_python_repository_response.py +122 -407
- pulpcore/client/pulp_python/models/repair.py +60 -95
- pulpcore/client/pulp_python/models/repository_add_remove_content.py +71 -157
- pulpcore/client/pulp_python/models/repository_sync_url.py +68 -129
- pulpcore/client/pulp_python/models/repository_version_response.py +104 -296
- pulpcore/client/pulp_python/models/set_label.py +80 -130
- pulpcore/client/pulp_python/models/set_label_response.py +80 -127
- pulpcore/client/pulp_python/models/summary_response.py +70 -160
- pulpcore/client/pulp_python/models/unset_label.py +75 -107
- pulpcore/client/pulp_python/models/unset_label_response.py +78 -129
- pulpcore/client/pulp_python/py.typed +0 -0
- pulpcore/client/pulp_python/rest.py +136 -170
- pulp_python_client-3.12.5.dist-info/METADATA +0 -17
- pulp_python_client-3.12.5.dist-info/RECORD +0 -65
- pulpcore/client/pulp_python/models/package_upload.py +0 -190
- pulpcore/client/pulp_python/models/python_bander_remote.py +0 -184
- pulpcore/client/pulp_python/models/python_python_package_content.py +0 -889
- pulpcore/client/pulp_python/models/python_python_remote_response_hidden_fields.py +0 -149
- {pulp_python_client-3.12.5.dist-info → pulp_python_client-3.13.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""API response object."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from typing import Optional, Generic, Mapping, TypeVar
|
|
5
|
+
from pydantic import Field, StrictInt, StrictBytes, BaseModel
|
|
6
|
+
|
|
7
|
+
T = TypeVar("T")
|
|
8
|
+
|
|
9
|
+
class ApiResponse(BaseModel, Generic[T]):
|
|
10
|
+
"""
|
|
11
|
+
API response object
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
status_code: StrictInt = Field(description="HTTP status code")
|
|
15
|
+
headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers")
|
|
16
|
+
data: T = Field(description="Deserialized data given the data type")
|
|
17
|
+
raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
|
|
18
|
+
|
|
19
|
+
model_config = {
|
|
20
|
+
"arbitrary_types_allowed": True
|
|
21
|
+
}
|
|
@@ -3,53 +3,166 @@
|
|
|
3
3
|
"""
|
|
4
4
|
Pulp 3 API
|
|
5
5
|
|
|
6
|
-
Fetch, Upload, Organize, and Distribute Software Packages
|
|
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
|
|
11
|
-
"""
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
12
11
|
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
13
14
|
|
|
14
|
-
from __future__ import absolute_import
|
|
15
15
|
|
|
16
16
|
import copy
|
|
17
|
+
import http.client as httplib
|
|
17
18
|
import logging
|
|
19
|
+
from logging import FileHandler
|
|
18
20
|
import multiprocessing
|
|
19
21
|
import sys
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict
|
|
23
|
+
from typing_extensions import NotRequired, Self
|
|
24
|
+
|
|
20
25
|
import urllib3
|
|
21
26
|
|
|
22
|
-
import six
|
|
23
|
-
from six.moves import http_client as httplib
|
|
24
27
|
|
|
28
|
+
JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
|
29
|
+
'multipleOf', 'maximum', 'exclusiveMaximum',
|
|
30
|
+
'minimum', 'exclusiveMinimum', 'maxLength',
|
|
31
|
+
'minLength', 'pattern', 'maxItems', 'minItems'
|
|
32
|
+
}
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
34
|
+
ServerVariablesT = Dict[str, str]
|
|
28
35
|
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
GenericAuthSetting = TypedDict(
|
|
37
|
+
"GenericAuthSetting",
|
|
38
|
+
{
|
|
39
|
+
"type": str,
|
|
40
|
+
"in": str,
|
|
41
|
+
"key": str,
|
|
42
|
+
"value": str,
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
OAuth2AuthSetting = TypedDict(
|
|
48
|
+
"OAuth2AuthSetting",
|
|
49
|
+
{
|
|
50
|
+
"type": Literal["oauth2"],
|
|
51
|
+
"in": Literal["header"],
|
|
52
|
+
"key": Literal["Authorization"],
|
|
53
|
+
"value": str,
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
APIKeyAuthSetting = TypedDict(
|
|
59
|
+
"APIKeyAuthSetting",
|
|
60
|
+
{
|
|
61
|
+
"type": Literal["api_key"],
|
|
62
|
+
"in": str,
|
|
63
|
+
"key": str,
|
|
64
|
+
"value": Optional[str],
|
|
65
|
+
},
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
BasicAuthSetting = TypedDict(
|
|
70
|
+
"BasicAuthSetting",
|
|
71
|
+
{
|
|
72
|
+
"type": Literal["basic"],
|
|
73
|
+
"in": Literal["header"],
|
|
74
|
+
"key": Literal["Authorization"],
|
|
75
|
+
"value": Optional[str],
|
|
76
|
+
},
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
BearerFormatAuthSetting = TypedDict(
|
|
81
|
+
"BearerFormatAuthSetting",
|
|
82
|
+
{
|
|
83
|
+
"type": Literal["bearer"],
|
|
84
|
+
"in": Literal["header"],
|
|
85
|
+
"format": Literal["JWT"],
|
|
86
|
+
"key": Literal["Authorization"],
|
|
87
|
+
"value": str,
|
|
88
|
+
},
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
BearerAuthSetting = TypedDict(
|
|
93
|
+
"BearerAuthSetting",
|
|
94
|
+
{
|
|
95
|
+
"type": Literal["bearer"],
|
|
96
|
+
"in": Literal["header"],
|
|
97
|
+
"key": Literal["Authorization"],
|
|
98
|
+
"value": str,
|
|
99
|
+
},
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
HTTPSignatureAuthSetting = TypedDict(
|
|
104
|
+
"HTTPSignatureAuthSetting",
|
|
105
|
+
{
|
|
106
|
+
"type": Literal["http-signature"],
|
|
107
|
+
"in": Literal["header"],
|
|
108
|
+
"key": Literal["Authorization"],
|
|
109
|
+
"value": None,
|
|
110
|
+
},
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
AuthSettings = TypedDict(
|
|
115
|
+
"AuthSettings",
|
|
116
|
+
{
|
|
117
|
+
"basicAuth": BasicAuthSetting,
|
|
118
|
+
"cookieAuth": APIKeyAuthSetting,
|
|
119
|
+
},
|
|
120
|
+
total=False,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class HostSettingVariable(TypedDict):
|
|
125
|
+
description: str
|
|
126
|
+
default_value: str
|
|
127
|
+
enum_values: List[str]
|
|
31
128
|
|
|
32
|
-
|
|
129
|
+
|
|
130
|
+
class HostSetting(TypedDict):
|
|
131
|
+
url: str
|
|
132
|
+
description: str
|
|
133
|
+
variables: NotRequired[Dict[str, HostSettingVariable]]
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class Configuration:
|
|
137
|
+
"""This class contains various settings of the API client.
|
|
138
|
+
|
|
139
|
+
:param host: Base url.
|
|
140
|
+
:param ignore_operation_servers
|
|
141
|
+
Boolean to ignore operation servers for the API client.
|
|
142
|
+
Config will use `host` as the base url regardless of the operation servers.
|
|
33
143
|
:param api_key: Dict to store API key(s).
|
|
34
144
|
Each entry in the dict specifies an API key.
|
|
35
145
|
The dict key is the name of the security scheme in the OAS specification.
|
|
36
146
|
The dict value is the API key secret.
|
|
37
|
-
:param api_key_prefix: Dict to store API prefix (e.g. Bearer)
|
|
147
|
+
:param api_key_prefix: Dict to store API prefix (e.g. Bearer).
|
|
38
148
|
The dict key is the name of the security scheme in the OAS specification.
|
|
39
149
|
The dict value is an API key prefix when generating the auth data.
|
|
40
|
-
:param username: Username for HTTP basic authentication
|
|
41
|
-
:param password: Password for HTTP basic authentication
|
|
42
|
-
:param
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
150
|
+
:param username: Username for HTTP basic authentication.
|
|
151
|
+
:param password: Password for HTTP basic authentication.
|
|
152
|
+
:param access_token: Access token.
|
|
153
|
+
:param server_index: Index to servers configuration.
|
|
154
|
+
:param server_variables: Mapping with string values to replace variables in
|
|
155
|
+
templated server configuration. The validation of enums is performed for
|
|
156
|
+
variables with defined enum values before.
|
|
157
|
+
:param server_operation_index: Mapping from operation ID to an index to server
|
|
158
|
+
configuration.
|
|
159
|
+
:param server_operation_variables: Mapping from operation ID to a mapping with
|
|
160
|
+
string values to replace variables in templated server configuration.
|
|
161
|
+
The validation of enums is performed for variables with defined enum
|
|
162
|
+
values before.
|
|
163
|
+
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
|
164
|
+
in PEM format.
|
|
165
|
+
:param retries: Number of retries for API requests.
|
|
53
166
|
|
|
54
167
|
:Example:
|
|
55
168
|
|
|
@@ -89,18 +202,42 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
89
202
|
|
|
90
203
|
"""
|
|
91
204
|
|
|
92
|
-
_default = None
|
|
93
|
-
|
|
94
|
-
def __init__(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
205
|
+
_default: ClassVar[Optional[Self]] = None
|
|
206
|
+
|
|
207
|
+
def __init__(
|
|
208
|
+
self,
|
|
209
|
+
host: Optional[str]=None,
|
|
210
|
+
api_key: Optional[Dict[str, str]]=None,
|
|
211
|
+
api_key_prefix: Optional[Dict[str, str]]=None,
|
|
212
|
+
username: Optional[str]=None,
|
|
213
|
+
password: Optional[str]=None,
|
|
214
|
+
access_token: Optional[str]=None,
|
|
215
|
+
server_index: Optional[int]=None,
|
|
216
|
+
server_variables: Optional[ServerVariablesT]=None,
|
|
217
|
+
server_operation_index: Optional[Dict[int, int]]=None,
|
|
218
|
+
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
|
|
219
|
+
ignore_operation_servers: bool=False,
|
|
220
|
+
ssl_ca_cert: Optional[str]=None,
|
|
221
|
+
retries: Optional[int] = None,
|
|
222
|
+
*,
|
|
223
|
+
debug: Optional[bool] = None,
|
|
224
|
+
) -> None:
|
|
99
225
|
"""Constructor
|
|
100
226
|
"""
|
|
101
|
-
self.
|
|
227
|
+
self._base_path = "http://localhost:24817" if host is None else host
|
|
102
228
|
"""Default Base url
|
|
103
229
|
"""
|
|
230
|
+
self.server_index = 0 if server_index is None and host is None else server_index
|
|
231
|
+
self.server_operation_index = server_operation_index or {}
|
|
232
|
+
"""Default server index
|
|
233
|
+
"""
|
|
234
|
+
self.server_variables = server_variables or {}
|
|
235
|
+
self.server_operation_variables = server_operation_variables or {}
|
|
236
|
+
"""Default server variables
|
|
237
|
+
"""
|
|
238
|
+
self.ignore_operation_servers = ignore_operation_servers
|
|
239
|
+
"""Ignore operation servers
|
|
240
|
+
"""
|
|
104
241
|
self.temp_folder_path = None
|
|
105
242
|
"""Temp file folder for downloading files
|
|
106
243
|
"""
|
|
@@ -124,7 +261,9 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
124
261
|
self.password = password
|
|
125
262
|
"""Password for HTTP basic authentication
|
|
126
263
|
"""
|
|
127
|
-
self.
|
|
264
|
+
self.access_token = access_token
|
|
265
|
+
"""Access token
|
|
266
|
+
"""
|
|
128
267
|
self.logger = {}
|
|
129
268
|
"""Logging Settings
|
|
130
269
|
"""
|
|
@@ -136,13 +275,16 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
136
275
|
self.logger_stream_handler = None
|
|
137
276
|
"""Log stream handler
|
|
138
277
|
"""
|
|
139
|
-
self.logger_file_handler = None
|
|
278
|
+
self.logger_file_handler: Optional[FileHandler] = None
|
|
140
279
|
"""Log file handler
|
|
141
280
|
"""
|
|
142
281
|
self.logger_file = None
|
|
143
282
|
"""Debug file location
|
|
144
283
|
"""
|
|
145
|
-
|
|
284
|
+
if debug is not None:
|
|
285
|
+
self.debug = debug
|
|
286
|
+
else:
|
|
287
|
+
self.__debug = False
|
|
146
288
|
"""Debug switch
|
|
147
289
|
"""
|
|
148
290
|
|
|
@@ -151,7 +293,7 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
151
293
|
Set this to false to skip verifying SSL certificate when calling API
|
|
152
294
|
from https server.
|
|
153
295
|
"""
|
|
154
|
-
self.ssl_ca_cert =
|
|
296
|
+
self.ssl_ca_cert = ssl_ca_cert
|
|
155
297
|
"""Set this to customize the certificate file to verify the peer.
|
|
156
298
|
"""
|
|
157
299
|
self.cert_file = None
|
|
@@ -163,6 +305,10 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
163
305
|
self.assert_hostname = None
|
|
164
306
|
"""Set this to True/False to enable/disable SSL hostname verification.
|
|
165
307
|
"""
|
|
308
|
+
self.tls_server_name = None
|
|
309
|
+
"""SSL/TLS Server Name Indication (SNI)
|
|
310
|
+
Set this to the SNI value expected by the server.
|
|
311
|
+
"""
|
|
166
312
|
|
|
167
313
|
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
|
|
168
314
|
"""urllib3 connection pool's maximum number of connections saved
|
|
@@ -172,7 +318,7 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
172
318
|
cpu_count * 5 is used as default value to increase performance.
|
|
173
319
|
"""
|
|
174
320
|
|
|
175
|
-
self.proxy = None
|
|
321
|
+
self.proxy: Optional[str] = None
|
|
176
322
|
"""Proxy URL
|
|
177
323
|
"""
|
|
178
324
|
self.proxy_headers = None
|
|
@@ -181,13 +327,25 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
181
327
|
self.safe_chars_for_path_param = '/'
|
|
182
328
|
"""Safe chars for path_param
|
|
183
329
|
"""
|
|
184
|
-
self.retries =
|
|
330
|
+
self.retries = retries
|
|
185
331
|
"""Adding retries to override urllib3 default value 3
|
|
186
332
|
"""
|
|
187
|
-
#
|
|
333
|
+
# Enable client side validation
|
|
188
334
|
self.client_side_validation = True
|
|
189
335
|
|
|
190
|
-
|
|
336
|
+
self.socket_options = None
|
|
337
|
+
"""Options to pass down to the underlying urllib3 socket
|
|
338
|
+
"""
|
|
339
|
+
|
|
340
|
+
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
|
|
341
|
+
"""datetime format
|
|
342
|
+
"""
|
|
343
|
+
|
|
344
|
+
self.date_format = "%Y-%m-%d"
|
|
345
|
+
"""date format
|
|
346
|
+
"""
|
|
347
|
+
|
|
348
|
+
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
|
|
191
349
|
cls = self.__class__
|
|
192
350
|
result = cls.__new__(cls)
|
|
193
351
|
memo[id(self)] = result
|
|
@@ -201,11 +359,11 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
201
359
|
result.debug = self.debug
|
|
202
360
|
return result
|
|
203
361
|
|
|
204
|
-
def __setattr__(self, name, value):
|
|
362
|
+
def __setattr__(self, name: str, value: Any) -> None:
|
|
205
363
|
object.__setattr__(self, name, value)
|
|
206
364
|
|
|
207
365
|
@classmethod
|
|
208
|
-
def set_default(cls, default):
|
|
366
|
+
def set_default(cls, default: Optional[Self]) -> None:
|
|
209
367
|
"""Set default instance of configuration.
|
|
210
368
|
|
|
211
369
|
It stores default configuration, which can be
|
|
@@ -213,24 +371,34 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
213
371
|
|
|
214
372
|
:param default: object of Configuration
|
|
215
373
|
"""
|
|
216
|
-
cls._default =
|
|
374
|
+
cls._default = default
|
|
217
375
|
|
|
218
376
|
@classmethod
|
|
219
|
-
def get_default_copy(cls):
|
|
220
|
-
"""
|
|
377
|
+
def get_default_copy(cls) -> Self:
|
|
378
|
+
"""Deprecated. Please use `get_default` instead.
|
|
379
|
+
|
|
380
|
+
Deprecated. Please use `get_default` instead.
|
|
381
|
+
|
|
382
|
+
:return: The configuration object.
|
|
383
|
+
"""
|
|
384
|
+
return cls.get_default()
|
|
385
|
+
|
|
386
|
+
@classmethod
|
|
387
|
+
def get_default(cls) -> Self:
|
|
388
|
+
"""Return the default configuration.
|
|
221
389
|
|
|
222
390
|
This method returns newly created, based on default constructor,
|
|
223
391
|
object of Configuration class or returns a copy of default
|
|
224
|
-
configuration
|
|
392
|
+
configuration.
|
|
225
393
|
|
|
226
394
|
:return: The configuration object.
|
|
227
395
|
"""
|
|
228
|
-
if cls._default is
|
|
229
|
-
|
|
230
|
-
return
|
|
396
|
+
if cls._default is None:
|
|
397
|
+
cls._default = cls()
|
|
398
|
+
return cls._default
|
|
231
399
|
|
|
232
400
|
@property
|
|
233
|
-
def logger_file(self):
|
|
401
|
+
def logger_file(self) -> Optional[str]:
|
|
234
402
|
"""The logger file.
|
|
235
403
|
|
|
236
404
|
If the logger_file is None, then add stream handler and remove file
|
|
@@ -242,7 +410,7 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
242
410
|
return self.__logger_file
|
|
243
411
|
|
|
244
412
|
@logger_file.setter
|
|
245
|
-
def logger_file(self, value):
|
|
413
|
+
def logger_file(self, value: Optional[str]) -> None:
|
|
246
414
|
"""The logger file.
|
|
247
415
|
|
|
248
416
|
If the logger_file is None, then add stream handler and remove file
|
|
@@ -257,11 +425,11 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
257
425
|
# then add file handler and remove stream handler.
|
|
258
426
|
self.logger_file_handler = logging.FileHandler(self.__logger_file)
|
|
259
427
|
self.logger_file_handler.setFormatter(self.logger_formatter)
|
|
260
|
-
for _, logger in
|
|
428
|
+
for _, logger in self.logger.items():
|
|
261
429
|
logger.addHandler(self.logger_file_handler)
|
|
262
430
|
|
|
263
431
|
@property
|
|
264
|
-
def debug(self):
|
|
432
|
+
def debug(self) -> bool:
|
|
265
433
|
"""Debug status
|
|
266
434
|
|
|
267
435
|
:param value: The debug status, True or False.
|
|
@@ -270,7 +438,7 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
270
438
|
return self.__debug
|
|
271
439
|
|
|
272
440
|
@debug.setter
|
|
273
|
-
def debug(self, value):
|
|
441
|
+
def debug(self, value: bool) -> None:
|
|
274
442
|
"""Debug status
|
|
275
443
|
|
|
276
444
|
:param value: The debug status, True or False.
|
|
@@ -279,20 +447,20 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
279
447
|
self.__debug = value
|
|
280
448
|
if self.__debug:
|
|
281
449
|
# if debug status is True, turn on debug logging
|
|
282
|
-
for _, logger in
|
|
450
|
+
for _, logger in self.logger.items():
|
|
283
451
|
logger.setLevel(logging.DEBUG)
|
|
284
452
|
# turn on httplib debug
|
|
285
453
|
httplib.HTTPConnection.debuglevel = 1
|
|
286
454
|
else:
|
|
287
455
|
# if debug status is False, turn off debug logging,
|
|
288
456
|
# setting log level to default `logging.WARNING`
|
|
289
|
-
for _, logger in
|
|
457
|
+
for _, logger in self.logger.items():
|
|
290
458
|
logger.setLevel(logging.WARNING)
|
|
291
459
|
# turn off httplib debug
|
|
292
460
|
httplib.HTTPConnection.debuglevel = 0
|
|
293
461
|
|
|
294
462
|
@property
|
|
295
|
-
def logger_format(self):
|
|
463
|
+
def logger_format(self) -> str:
|
|
296
464
|
"""The logger format.
|
|
297
465
|
|
|
298
466
|
The logger_formatter will be updated when sets logger_format.
|
|
@@ -303,7 +471,7 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
303
471
|
return self.__logger_format
|
|
304
472
|
|
|
305
473
|
@logger_format.setter
|
|
306
|
-
def logger_format(self, value):
|
|
474
|
+
def logger_format(self, value: str) -> None:
|
|
307
475
|
"""The logger format.
|
|
308
476
|
|
|
309
477
|
The logger_formatter will be updated when sets logger_format.
|
|
@@ -314,15 +482,16 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
314
482
|
self.__logger_format = value
|
|
315
483
|
self.logger_formatter = logging.Formatter(self.__logger_format)
|
|
316
484
|
|
|
317
|
-
def get_api_key_with_prefix(self, identifier):
|
|
485
|
+
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
|
|
318
486
|
"""Gets API key (with prefix if set).
|
|
319
487
|
|
|
320
488
|
:param identifier: The identifier of apiKey.
|
|
489
|
+
:param alias: The alternative identifier of apiKey.
|
|
321
490
|
:return: The token for api key authentication.
|
|
322
491
|
"""
|
|
323
492
|
if self.refresh_api_key_hook is not None:
|
|
324
493
|
self.refresh_api_key_hook(self)
|
|
325
|
-
key = self.api_key.get(identifier)
|
|
494
|
+
key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
|
|
326
495
|
if key:
|
|
327
496
|
prefix = self.api_key_prefix.get(identifier)
|
|
328
497
|
if prefix:
|
|
@@ -330,7 +499,9 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
330
499
|
else:
|
|
331
500
|
return key
|
|
332
501
|
|
|
333
|
-
|
|
502
|
+
return None
|
|
503
|
+
|
|
504
|
+
def get_basic_auth_token(self) -> Optional[str]:
|
|
334
505
|
"""Gets HTTP basic authentication header (string).
|
|
335
506
|
|
|
336
507
|
:return: The token for basic HTTP authentication.
|
|
@@ -345,12 +516,12 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
345
516
|
basic_auth=username + ':' + password
|
|
346
517
|
).get('authorization')
|
|
347
518
|
|
|
348
|
-
def auth_settings(self):
|
|
519
|
+
def auth_settings(self)-> AuthSettings:
|
|
349
520
|
"""Gets Auth Settings dict for api client.
|
|
350
521
|
|
|
351
522
|
:return: The Auth Settings information dict.
|
|
352
523
|
"""
|
|
353
|
-
auth = {}
|
|
524
|
+
auth: AuthSettings = {}
|
|
354
525
|
if self.username is not None and self.password is not None:
|
|
355
526
|
auth['basicAuth'] = {
|
|
356
527
|
'type': 'basic',
|
|
@@ -358,16 +529,18 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
358
529
|
'key': 'Authorization',
|
|
359
530
|
'value': self.get_basic_auth_token()
|
|
360
531
|
}
|
|
361
|
-
if '
|
|
532
|
+
if 'cookieAuth' in self.api_key:
|
|
362
533
|
auth['cookieAuth'] = {
|
|
363
534
|
'type': 'api_key',
|
|
364
535
|
'in': 'cookie',
|
|
365
536
|
'key': 'sessionid',
|
|
366
|
-
'value': self.get_api_key_with_prefix(
|
|
537
|
+
'value': self.get_api_key_with_prefix(
|
|
538
|
+
'cookieAuth',
|
|
539
|
+
),
|
|
367
540
|
}
|
|
368
541
|
return auth
|
|
369
542
|
|
|
370
|
-
def to_debug_report(self):
|
|
543
|
+
def to_debug_report(self) -> str:
|
|
371
544
|
"""Gets the essential information for debugging.
|
|
372
545
|
|
|
373
546
|
:return: The report for debugging.
|
|
@@ -376,29 +549,38 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
376
549
|
"OS: {env}\n"\
|
|
377
550
|
"Python Version: {pyversion}\n"\
|
|
378
551
|
"Version of the API: v3\n"\
|
|
379
|
-
"SDK Package Version: 3.
|
|
552
|
+
"SDK Package Version: 3.13.1".\
|
|
380
553
|
format(env=sys.platform, pyversion=sys.version)
|
|
381
554
|
|
|
382
|
-
def get_host_settings(self):
|
|
555
|
+
def get_host_settings(self) -> List[HostSetting]:
|
|
383
556
|
"""Gets an array of host settings
|
|
384
557
|
|
|
385
558
|
:return: An array of host settings
|
|
386
559
|
"""
|
|
387
560
|
return [
|
|
388
561
|
{
|
|
389
|
-
'url': "http://localhost:24817
|
|
562
|
+
'url': "http://localhost:24817",
|
|
390
563
|
'description': "No description provided",
|
|
391
564
|
}
|
|
392
565
|
]
|
|
393
566
|
|
|
394
|
-
def get_host_from_settings(
|
|
567
|
+
def get_host_from_settings(
|
|
568
|
+
self,
|
|
569
|
+
index: Optional[int],
|
|
570
|
+
variables: Optional[ServerVariablesT]=None,
|
|
571
|
+
servers: Optional[List[HostSetting]]=None,
|
|
572
|
+
) -> str:
|
|
395
573
|
"""Gets host URL based on the index and variables
|
|
396
574
|
:param index: array index of the host settings
|
|
397
575
|
:param variables: hash of variable and the corresponding value
|
|
576
|
+
:param servers: an array of host settings or None
|
|
398
577
|
:return: URL based on host settings
|
|
399
578
|
"""
|
|
579
|
+
if index is None:
|
|
580
|
+
return self._base_path
|
|
581
|
+
|
|
400
582
|
variables = {} if variables is None else variables
|
|
401
|
-
servers = self.get_host_settings()
|
|
583
|
+
servers = self.get_host_settings() if servers is None else servers
|
|
402
584
|
|
|
403
585
|
try:
|
|
404
586
|
server = servers[index]
|
|
@@ -410,7 +592,7 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
410
592
|
url = server['url']
|
|
411
593
|
|
|
412
594
|
# go through variables and replace placeholders
|
|
413
|
-
for variable_name, variable in server
|
|
595
|
+
for variable_name, variable in server.get('variables', {}).items():
|
|
414
596
|
used_value = variables.get(
|
|
415
597
|
variable_name, variable['default_value'])
|
|
416
598
|
|
|
@@ -425,3 +607,14 @@ conf = pulpcore.client.pulp_python.Configuration(
|
|
|
425
607
|
url = url.replace("{" + variable_name + "}", used_value)
|
|
426
608
|
|
|
427
609
|
return url
|
|
610
|
+
|
|
611
|
+
@property
|
|
612
|
+
def host(self) -> str:
|
|
613
|
+
"""Return generated host."""
|
|
614
|
+
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
|
|
615
|
+
|
|
616
|
+
@host.setter
|
|
617
|
+
def host(self, value: str) -> None:
|
|
618
|
+
"""Fix base path."""
|
|
619
|
+
self._base_path = value
|
|
620
|
+
self.server_index = None
|