pulp_2to3_migration_client 0.2.0b3.dev01592314856 → 0.2.0b4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/lib/pulp_2to3_migration_client/version.rb +1 -1
  4. metadata +2 -41
  5. data/pulpcore/__init__.py +0 -2
  6. data/pulpcore/client/__init__.py +0 -2
  7. data/pulpcore/client/pulp_2to3_migration/__init__.py +0 -42
  8. data/pulpcore/client/pulp_2to3_migration/api/__init__.py +0 -8
  9. data/pulpcore/client/pulp_2to3_migration/api/migration_plans_api.py +0 -609
  10. data/pulpcore/client/pulp_2to3_migration/api/pulp2content_api.py +0 -317
  11. data/pulpcore/client/pulp_2to3_migration/api/pulp2repositories_api.py +0 -289
  12. data/pulpcore/client/pulp_2to3_migration/api_client.py +0 -647
  13. data/pulpcore/client/pulp_2to3_migration/configuration.py +0 -387
  14. data/pulpcore/client/pulp_2to3_migration/exceptions.py +0 -120
  15. data/pulpcore/client/pulp_2to3_migration/models/__init__.py +0 -25
  16. data/pulpcore/client/pulp_2to3_migration/models/async_operation_response.py +0 -123
  17. data/pulpcore/client/pulp_2to3_migration/models/inline_response200.py +0 -198
  18. data/pulpcore/client/pulp_2to3_migration/models/inline_response2001.py +0 -198
  19. data/pulpcore/client/pulp_2to3_migration/models/inline_response2002.py +0 -198
  20. data/pulpcore/client/pulp_2to3_migration/models/migration_plan_run.py +0 -150
  21. data/pulpcore/client/pulp_2to3_migration/models/pulp2to3_migration_migration_plan.py +0 -177
  22. data/pulpcore/client/pulp_2to3_migration/models/pulp2to3_migration_migration_plan_read.py +0 -177
  23. data/pulpcore/client/pulp_2to3_migration/models/pulp2to3_migration_pulp2_content_read.py +0 -353
  24. data/pulpcore/client/pulp_2to3_migration/models/pulp2to3_migration_pulp2_repository_read.py +0 -441
  25. data/pulpcore/client/pulp_2to3_migration/rest.py +0 -296
  26. data/requirements.txt +0 -6
  27. data/setup.cfg +0 -2
  28. data/setup.py +0 -41
  29. data/test-requirements.txt +0 -3
  30. data/test/__init__.py +0 -0
  31. data/test/test_async_operation_response.py +0 -53
  32. data/test/test_inline_response200.py +0 -67
  33. data/test/test_inline_response2001.py +0 -79
  34. data/test/test_inline_response2002.py +0 -89
  35. data/test/test_migration_plan_run.py +0 -53
  36. data/test/test_migration_plans_api.py +0 -68
  37. data/test/test_pulp2content_api.py +0 -47
  38. data/test/test_pulp2repositories_api.py +0 -47
  39. data/test/test_pulp2to3_migration_migration_plan.py +0 -55
  40. data/test/test_pulp2to3_migration_migration_plan_read.py +0 -55
  41. data/test/test_pulp2to3_migration_pulp2_content_read.py +0 -64
  42. data/test/test_pulp2to3_migration_pulp2_repository_read.py +0 -68
  43. data/tox.ini +0 -9
@@ -1,387 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
7
-
8
- The version of the OpenAPI document: v3
9
- Generated by: https://openapi-generator.tech
10
- """
11
-
12
-
13
- from __future__ import absolute_import
14
-
15
- import logging
16
- import multiprocessing
17
- import sys
18
- import urllib3
19
-
20
- import six
21
- from six.moves import http_client as httplib
22
-
23
-
24
- class Configuration(object):
25
- """NOTE: This class is auto generated by OpenAPI Generator
26
-
27
- Ref: https://openapi-generator.tech
28
- Do not edit the class manually.
29
-
30
- :param host: Base url
31
- :param api_key: Dict to store API key(s).
32
- Each entry in the dict specifies an API key.
33
- The dict key is the name of the security scheme in the OAS specification.
34
- The dict value is the API key secret.
35
- :param api_key_prefix: Dict to store API prefix (e.g. Bearer)
36
- The dict key is the name of the security scheme in the OAS specification.
37
- The dict value is an API key prefix when generating the auth data.
38
- :param username: Username for HTTP basic authentication
39
- :param password: Password for HTTP basic authentication
40
- :param signing_info: Configuration parameters for HTTP signature.
41
- Must be an instance of pulpcore.client.pulp_2to3_migration.signing.HttpSigningConfiguration
42
-
43
- :Example:
44
-
45
- Given the following security scheme in the OpenAPI specification:
46
- components:
47
- securitySchemes:
48
- cookieAuth: # name for the security scheme
49
- type: apiKey
50
- in: cookie
51
- name: JSESSIONID # cookie name
52
-
53
- You can programmatically set the cookie:
54
- conf = pulpcore.client.pulp_2to3_migration.Configuration(
55
- api_key={'cookieAuth': 'abc123'}
56
- api_key_prefix={'cookieAuth': 'JSESSIONID'}
57
- )
58
- The following cookie will be added to the HTTP request:
59
- Cookie: JSESSIONID abc123
60
-
61
- Configure API client with HTTP basic authentication:
62
- conf = pulpcore.client.pulp_2to3_migration.Configuration(
63
- username='the-user',
64
- password='the-password',
65
- )
66
-
67
- Configure API client with HTTP signature authentication. Use the 'hs2019' signature scheme,
68
- sign the HTTP requests with the RSA-SSA-PSS signature algorithm, and set the expiration time
69
- of the signature to 5 minutes after the signature has been created.
70
- Note you can use the constants defined in the pulpcore.client.pulp_2to3_migration.signing module, and you can
71
- also specify arbitrary HTTP headers to be included in the HTTP signature, except for the
72
- 'Authorization' header, which is used to carry the signature.
73
-
74
- One may be tempted to sign all headers by default, but in practice it rarely works.
75
- This is beccause explicit proxies, transparent proxies, TLS termination endpoints or
76
- load balancers may add/modify/remove headers. Include the HTTP headers that you know
77
- are not going to be modified in transit.
78
-
79
- conf = pulpcore.client.pulp_2to3_migration.Configuration(
80
- signing_info = pulpcore.client.pulp_2to3_migration.signing.HttpSigningConfiguration(
81
- key_id = 'my-key-id',
82
- private_key_path = 'rsa.pem',
83
- signing_scheme = signing.SCHEME_HS2019,
84
- signing_algorithm = signing.ALGORITHM_RSASSA_PSS,
85
- signed_headers = [signing.HEADER_REQUEST_TARGET,
86
- signing.HEADER_CREATED,
87
- signing.HEADER_EXPIRES,
88
- signing.HEADER_HOST,
89
- signing.HEADER_DATE,
90
- signing.HEADER_DIGEST,
91
- 'Content-Type',
92
- 'Content-Length',
93
- 'User-Agent'
94
- ],
95
- signature_max_validity = datetime.timedelta(minutes=5)
96
- )
97
- )
98
- """
99
-
100
- def __init__(self, host="http://pulp",
101
- api_key=None, api_key_prefix=None,
102
- username=None, password=None,
103
- signing_info=None):
104
- """Constructor
105
- """
106
- self.host = host
107
- """Default Base url
108
- """
109
- self.temp_folder_path = None
110
- """Temp file folder for downloading files
111
- """
112
- # Authentication Settings
113
- self.api_key = {}
114
- if api_key:
115
- self.api_key = api_key
116
- """dict to store API key(s)
117
- """
118
- self.api_key_prefix = {}
119
- if api_key_prefix:
120
- self.api_key_prefix = api_key_prefix
121
- """dict to store API prefix (e.g. Bearer)
122
- """
123
- self.refresh_api_key_hook = None
124
- """function hook to refresh API key if expired
125
- """
126
- self.username = username
127
- """Username for HTTP basic authentication
128
- """
129
- self.password = password
130
- """Password for HTTP basic authentication
131
- """
132
- if signing_info is not None:
133
- signing_info.host = host
134
- self.signing_info = signing_info
135
- """The HTTP signing configuration
136
- """
137
- self.logger = {}
138
- """Logging Settings
139
- """
140
- self.logger["package_logger"] = logging.getLogger("pulpcore.client.pulp_2to3_migration")
141
- self.logger["urllib3_logger"] = logging.getLogger("urllib3")
142
- self.logger_format = '%(asctime)s %(levelname)s %(message)s'
143
- """Log format
144
- """
145
- self.logger_stream_handler = None
146
- """Log stream handler
147
- """
148
- self.logger_file_handler = None
149
- """Log file handler
150
- """
151
- self.logger_file = None
152
- """Debug file location
153
- """
154
- self.debug = False
155
- """Debug switch
156
- """
157
-
158
- self.verify_ssl = True
159
- """SSL/TLS verification
160
- Set this to false to skip verifying SSL certificate when calling API
161
- from https server.
162
- """
163
- self.ssl_ca_cert = None
164
- """Set this to customize the certificate file to verify the peer.
165
- """
166
- self.cert_file = None
167
- """client certificate file
168
- """
169
- self.key_file = None
170
- """client key file
171
- """
172
- self.assert_hostname = None
173
- """Set this to True/False to enable/disable SSL hostname verification.
174
- """
175
-
176
- self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
177
- """urllib3 connection pool's maximum number of connections saved
178
- per pool. urllib3 uses 1 connection as default value, but this is
179
- not the best value when you are making a lot of possibly parallel
180
- requests to the same host, which is often the case here.
181
- cpu_count * 5 is used as default value to increase performance.
182
- """
183
-
184
- self.proxy = None
185
- """Proxy URL
186
- """
187
- self.proxy_headers = None
188
- """Proxy headers
189
- """
190
- self.safe_chars_for_path_param = ''
191
- """Safe chars for path_param
192
- """
193
- self.retries = None
194
- """Adding retries to override urllib3 default value 3
195
- """
196
- # Disable client side validation
197
- self.client_side_validation = True
198
-
199
- @property
200
- def logger_file(self):
201
- """The logger file.
202
-
203
- If the logger_file is None, then add stream handler and remove file
204
- handler. Otherwise, add file handler and remove stream handler.
205
-
206
- :param value: The logger_file path.
207
- :type: str
208
- """
209
- return self.__logger_file
210
-
211
- @logger_file.setter
212
- def logger_file(self, value):
213
- """The logger file.
214
-
215
- If the logger_file is None, then add stream handler and remove file
216
- handler. Otherwise, add file handler and remove stream handler.
217
-
218
- :param value: The logger_file path.
219
- :type: str
220
- """
221
- self.__logger_file = value
222
- if self.__logger_file:
223
- # If set logging file,
224
- # then add file handler and remove stream handler.
225
- self.logger_file_handler = logging.FileHandler(self.__logger_file)
226
- self.logger_file_handler.setFormatter(self.logger_formatter)
227
- for _, logger in six.iteritems(self.logger):
228
- logger.addHandler(self.logger_file_handler)
229
-
230
- @property
231
- def debug(self):
232
- """Debug status
233
-
234
- :param value: The debug status, True or False.
235
- :type: bool
236
- """
237
- return self.__debug
238
-
239
- @debug.setter
240
- def debug(self, value):
241
- """Debug status
242
-
243
- :param value: The debug status, True or False.
244
- :type: bool
245
- """
246
- self.__debug = value
247
- if self.__debug:
248
- # if debug status is True, turn on debug logging
249
- for _, logger in six.iteritems(self.logger):
250
- logger.setLevel(logging.DEBUG)
251
- # turn on httplib debug
252
- httplib.HTTPConnection.debuglevel = 1
253
- else:
254
- # if debug status is False, turn off debug logging,
255
- # setting log level to default `logging.WARNING`
256
- for _, logger in six.iteritems(self.logger):
257
- logger.setLevel(logging.WARNING)
258
- # turn off httplib debug
259
- httplib.HTTPConnection.debuglevel = 0
260
-
261
- @property
262
- def logger_format(self):
263
- """The logger format.
264
-
265
- The logger_formatter will be updated when sets logger_format.
266
-
267
- :param value: The format string.
268
- :type: str
269
- """
270
- return self.__logger_format
271
-
272
- @logger_format.setter
273
- def logger_format(self, value):
274
- """The logger format.
275
-
276
- The logger_formatter will be updated when sets logger_format.
277
-
278
- :param value: The format string.
279
- :type: str
280
- """
281
- self.__logger_format = value
282
- self.logger_formatter = logging.Formatter(self.__logger_format)
283
-
284
- def get_api_key_with_prefix(self, identifier):
285
- """Gets API key (with prefix if set).
286
-
287
- :param identifier: The identifier of apiKey.
288
- :return: The token for api key authentication.
289
- """
290
- if self.refresh_api_key_hook is not None:
291
- self.refresh_api_key_hook(self)
292
- key = self.api_key.get(identifier)
293
- if key:
294
- prefix = self.api_key_prefix.get(identifier)
295
- if prefix:
296
- return "%s %s" % (prefix, key)
297
- else:
298
- return key
299
-
300
- def get_basic_auth_token(self):
301
- """Gets HTTP basic authentication header (string).
302
-
303
- :return: The token for basic HTTP authentication.
304
- """
305
- username = ""
306
- if self.username is not None:
307
- username = self.username
308
- password = ""
309
- if self.password is not None:
310
- password = self.password
311
- return urllib3.util.make_headers(
312
- basic_auth=username + ':' + password
313
- ).get('authorization')
314
-
315
- def auth_settings(self):
316
- """Gets Auth Settings dict for api client.
317
-
318
- :return: The Auth Settings information dict.
319
- """
320
- auth = {}
321
- if self.username is not None and self.password is not None:
322
- auth['Basic'] = {
323
- 'type': 'basic',
324
- 'in': 'header',
325
- 'key': 'Authorization',
326
- 'value': self.get_basic_auth_token()
327
- }
328
- return auth
329
-
330
- def to_debug_report(self):
331
- """Gets the essential information for debugging.
332
-
333
- :return: The report for debugging.
334
- """
335
- return "Python SDK Debug Report:\n"\
336
- "OS: {env}\n"\
337
- "Python Version: {pyversion}\n"\
338
- "Version of the API: v3\n"\
339
- "SDK Package Version: 0.2.0b3.dev0".\
340
- format(env=sys.platform, pyversion=sys.version)
341
-
342
- def get_host_settings(self):
343
- """Gets an array of host settings
344
-
345
- :return: An array of host settings
346
- """
347
- return [
348
- {
349
- 'url': "http://pulp/",
350
- 'description': "No description provided",
351
- }
352
- ]
353
-
354
- def get_host_from_settings(self, index, variables=None):
355
- """Gets host URL based on the index and variables
356
- :param index: array index of the host settings
357
- :param variables: hash of variable and the corresponding value
358
- :return: URL based on host settings
359
- """
360
- variables = {} if variables is None else variables
361
- servers = self.get_host_settings()
362
-
363
- try:
364
- server = servers[index]
365
- except IndexError:
366
- raise ValueError(
367
- "Invalid index {0} when selecting the host settings. "
368
- "Must be less than {1}".format(index, len(servers)))
369
-
370
- url = server['url']
371
-
372
- # go through variables and replace placeholders
373
- for variable_name, variable in server['variables'].items():
374
- used_value = variables.get(
375
- variable_name, variable['default_value'])
376
-
377
- if 'enum_values' in variable \
378
- and used_value not in variable['enum_values']:
379
- raise ValueError(
380
- "The variable `{0}` in the host URL has invalid value "
381
- "{1}. Must be {2}.".format(
382
- variable_name, variables[variable_name],
383
- variable['enum_values']))
384
-
385
- url = url.replace("{" + variable_name + "}", used_value)
386
-
387
- return url
@@ -1,120 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
7
-
8
- The version of the OpenAPI document: v3
9
- Generated by: https://openapi-generator.tech
10
- """
11
-
12
-
13
- import six
14
-
15
-
16
- class OpenApiException(Exception):
17
- """The base exception class for all OpenAPIExceptions"""
18
-
19
-
20
- class ApiTypeError(OpenApiException, TypeError):
21
- def __init__(self, msg, path_to_item=None, valid_classes=None,
22
- key_type=None):
23
- """ Raises an exception for TypeErrors
24
-
25
- Args:
26
- msg (str): the exception message
27
-
28
- Keyword Args:
29
- path_to_item (list): a list of keys an indices to get to the
30
- current_item
31
- None if unset
32
- valid_classes (tuple): the primitive classes that current item
33
- should be an instance of
34
- None if unset
35
- key_type (bool): False if our value is a value in a dict
36
- True if it is a key in a dict
37
- False if our item is an item in a list
38
- None if unset
39
- """
40
- self.path_to_item = path_to_item
41
- self.valid_classes = valid_classes
42
- self.key_type = key_type
43
- full_msg = msg
44
- if path_to_item:
45
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
46
- super(ApiTypeError, self).__init__(full_msg)
47
-
48
-
49
- class ApiValueError(OpenApiException, ValueError):
50
- def __init__(self, msg, path_to_item=None):
51
- """
52
- Args:
53
- msg (str): the exception message
54
-
55
- Keyword Args:
56
- path_to_item (list) the path to the exception in the
57
- received_data dict. None if unset
58
- """
59
-
60
- self.path_to_item = path_to_item
61
- full_msg = msg
62
- if path_to_item:
63
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
64
- super(ApiValueError, self).__init__(full_msg)
65
-
66
-
67
- class ApiKeyError(OpenApiException, KeyError):
68
- def __init__(self, msg, path_to_item=None):
69
- """
70
- Args:
71
- msg (str): the exception message
72
-
73
- Keyword Args:
74
- path_to_item (None/list) the path to the exception in the
75
- received_data dict
76
- """
77
- self.path_to_item = path_to_item
78
- full_msg = msg
79
- if path_to_item:
80
- full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
81
- super(ApiKeyError, self).__init__(full_msg)
82
-
83
-
84
- class ApiException(OpenApiException):
85
-
86
- def __init__(self, status=None, reason=None, http_resp=None):
87
- if http_resp:
88
- self.status = http_resp.status
89
- self.reason = http_resp.reason
90
- self.body = http_resp.data
91
- self.headers = http_resp.getheaders()
92
- else:
93
- self.status = status
94
- self.reason = reason
95
- self.body = None
96
- self.headers = None
97
-
98
- def __str__(self):
99
- """Custom error messages for exception"""
100
- error_message = "({0})\n"\
101
- "Reason: {1}\n".format(self.status, self.reason)
102
- if self.headers:
103
- error_message += "HTTP response headers: {0}\n".format(
104
- self.headers)
105
-
106
- if self.body:
107
- error_message += "HTTP response body: {0}\n".format(self.body)
108
-
109
- return error_message
110
-
111
-
112
- def render_path(path_to_item):
113
- """Returns a string representation of a path"""
114
- result = ""
115
- for pth in path_to_item:
116
- if isinstance(pth, six.integer_types):
117
- result += "[{0}]".format(pth)
118
- else:
119
- result += "['{0}']".format(pth)
120
- return result