lockss-pyclient 0.1.0.dev1__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.
- lockss/pyclient/__init__.py +67 -0
- lockss/pyclient/config/__init__.py +42 -0
- lockss/pyclient/config/api/__init__.py +12 -0
- lockss/pyclient/config/api/aus_api.py +2195 -0
- lockss/pyclient/config/api/config_api.py +718 -0
- lockss/pyclient/config/api/plugins_api.py +128 -0
- lockss/pyclient/config/api/status_api.py +120 -0
- lockss/pyclient/config/api/tdb_api.py +318 -0
- lockss/pyclient/config/api/users_api.py +516 -0
- lockss/pyclient/config/api/utils_api.py +128 -0
- lockss/pyclient/config/api_client.py +632 -0
- lockss/pyclient/config/configuration.py +254 -0
- lockss/pyclient/config/models/__init__.py +30 -0
- lockss/pyclient/config/models/api_status.py +344 -0
- lockss/pyclient/config/models/au_configuration.py +142 -0
- lockss/pyclient/config/models/au_status.py +113 -0
- lockss/pyclient/config/models/au_ws_result.py +113 -0
- lockss/pyclient/config/models/auids_body.py +168 -0
- lockss/pyclient/config/models/check_substance_result.py +212 -0
- lockss/pyclient/config/models/content_configuration_result.py +200 -0
- lockss/pyclient/config/models/file_section_name_body.py +113 -0
- lockss/pyclient/config/models/platform_configuration_ws_result.py +113 -0
- lockss/pyclient/config/models/plugin_ws_result.py +345 -0
- lockss/pyclient/config/models/request_au_control_result.py +171 -0
- lockss/pyclient/config/models/tdb_au_ws_result.py +360 -0
- lockss/pyclient/config/models/tdb_publisher_ws_result.py +113 -0
- lockss/pyclient/config/models/tdb_title_ws_result.py +390 -0
- lockss/pyclient/config/rest.py +317 -0
- lockss/pyclient/crawler/__init__.py +45 -0
- lockss/pyclient/crawler/api/__init__.py +10 -0
- lockss/pyclient/crawler/api/crawlers_api.py +215 -0
- lockss/pyclient/crawler/api/crawls_api.py +952 -0
- lockss/pyclient/crawler/api/jobs_api.py +504 -0
- lockss/pyclient/crawler/api/status_api.py +120 -0
- lockss/pyclient/crawler/api/ws_api.py +128 -0
- lockss/pyclient/crawler/api_client.py +632 -0
- lockss/pyclient/crawler/configuration.py +254 -0
- lockss/pyclient/crawler/models/__init__.py +35 -0
- lockss/pyclient/crawler/models/api_status.py +344 -0
- lockss/pyclient/crawler/models/counter.py +142 -0
- lockss/pyclient/crawler/models/crawl_desc.py +344 -0
- lockss/pyclient/crawler/models/crawl_job.py +280 -0
- lockss/pyclient/crawler/models/crawl_pager.py +140 -0
- lockss/pyclient/crawler/models/crawl_status.py +780 -0
- lockss/pyclient/crawler/models/crawl_ws_result.py +814 -0
- lockss/pyclient/crawler/models/crawl_ws_result_pages_with_errors.py +162 -0
- lockss/pyclient/crawler/models/crawler_config.py +142 -0
- lockss/pyclient/crawler/models/crawler_status.py +279 -0
- lockss/pyclient/crawler/models/crawler_statuses.py +112 -0
- lockss/pyclient/crawler/models/error_result.py +164 -0
- lockss/pyclient/crawler/models/job_pager.py +140 -0
- lockss/pyclient/crawler/models/job_status.py +147 -0
- lockss/pyclient/crawler/models/mime_counter.py +169 -0
- lockss/pyclient/crawler/models/page_info.py +228 -0
- lockss/pyclient/crawler/models/url_error.py +148 -0
- lockss/pyclient/crawler/models/url_info.py +167 -0
- lockss/pyclient/crawler/models/url_pager.py +140 -0
- lockss/pyclient/crawler/rest.py +317 -0
- lockss/pyclient/md/__init__.py +36 -0
- lockss/pyclient/md/api/__init__.py +9 -0
- lockss/pyclient/md/api/mdupdates_api.py +508 -0
- lockss/pyclient/md/api/metadata_api.py +136 -0
- lockss/pyclient/md/api/status_api.py +120 -0
- lockss/pyclient/md/api/urls_api.py +224 -0
- lockss/pyclient/md/api_client.py +632 -0
- lockss/pyclient/md/configuration.py +254 -0
- lockss/pyclient/md/models/__init__.py +27 -0
- lockss/pyclient/md/models/api_status.py +344 -0
- lockss/pyclient/md/models/au.py +169 -0
- lockss/pyclient/md/models/au_metadata_page_info.py +140 -0
- lockss/pyclient/md/models/error_result.py +164 -0
- lockss/pyclient/md/models/item_metadata.py +196 -0
- lockss/pyclient/md/models/job.py +280 -0
- lockss/pyclient/md/models/job_page_info.py +140 -0
- lockss/pyclient/md/models/metadata_update_spec.py +142 -0
- lockss/pyclient/md/models/page_info.py +228 -0
- lockss/pyclient/md/models/status.py +142 -0
- lockss/pyclient/md/models/url_info.py +142 -0
- lockss/pyclient/md/rest.py +317 -0
- lockss/pyclient/poller/__init__.py +54 -0
- lockss/pyclient/poller/api/__init__.py +13 -0
- lockss/pyclient/poller/api/export_api.py +156 -0
- lockss/pyclient/poller/api/hash_api.py +413 -0
- lockss/pyclient/poller/api/import_api.py +157 -0
- lockss/pyclient/poller/api/poll_detail_api.py +374 -0
- lockss/pyclient/poller/api/poller_polls_api.py +223 -0
- lockss/pyclient/poller/api/repo_api.py +223 -0
- lockss/pyclient/poller/api/service_api.py +694 -0
- lockss/pyclient/poller/api/voter_polls_api.py +223 -0
- lockss/pyclient/poller/api_client.py +632 -0
- lockss/pyclient/poller/configuration.py +254 -0
- lockss/pyclient/poller/models/__init__.py +41 -0
- lockss/pyclient/poller/models/api_status.py +344 -0
- lockss/pyclient/poller/models/aus_import_body.py +199 -0
- lockss/pyclient/poller/models/cached_uri_set_spec.py +169 -0
- lockss/pyclient/poller/models/error_result.py +164 -0
- lockss/pyclient/poller/models/hasher_ws_params.py +432 -0
- lockss/pyclient/poller/models/link_desc.py +141 -0
- lockss/pyclient/poller/models/page_desc.py +227 -0
- lockss/pyclient/poller/models/peer_data.py +638 -0
- lockss/pyclient/poller/models/peer_ws_result.py +113 -0
- lockss/pyclient/poller/models/poll_desc.py +285 -0
- lockss/pyclient/poller/models/poll_ws_result.py +142 -0
- lockss/pyclient/poller/models/poller_detail.py +613 -0
- lockss/pyclient/poller/models/poller_pager.py +139 -0
- lockss/pyclient/poller/models/poller_summary.py +452 -0
- lockss/pyclient/poller/models/repair_data.py +176 -0
- lockss/pyclient/poller/models/repair_pager.py +139 -0
- lockss/pyclient/poller/models/repair_queue.py +249 -0
- lockss/pyclient/poller/models/repository_space_ws_result.py +113 -0
- lockss/pyclient/poller/models/repository_ws_result.py +113 -0
- lockss/pyclient/poller/models/tally_data.py +471 -0
- lockss/pyclient/poller/models/url_pager.py +139 -0
- lockss/pyclient/poller/models/vote_ws_result.py +142 -0
- lockss/pyclient/poller/models/voter_detail.py +701 -0
- lockss/pyclient/poller/models/voter_pager.py +139 -0
- lockss/pyclient/poller/models/voter_summary.py +284 -0
- lockss/pyclient/poller/rest.py +317 -0
- lockss/pyclient/rs/__init__.py +41 -0
- lockss/pyclient/rs/api/__init__.py +10 -0
- lockss/pyclient/rs/api/artifacts_api.py +988 -0
- lockss/pyclient/rs/api/aus_api.py +334 -0
- lockss/pyclient/rs/api/repo_api.py +379 -0
- lockss/pyclient/rs/api/status_api.py +120 -0
- lockss/pyclient/rs/api/wayback_api.py +386 -0
- lockss/pyclient/rs/api_client.py +632 -0
- lockss/pyclient/rs/configuration.py +247 -0
- lockss/pyclient/rs/models/__init__.py +31 -0
- lockss/pyclient/rs/models/api_status.py +344 -0
- lockss/pyclient/rs/models/archives_body.py +142 -0
- lockss/pyclient/rs/models/artifact.py +344 -0
- lockss/pyclient/rs/models/artifact_page_info.py +140 -0
- lockss/pyclient/rs/models/artifact_properties.py +344 -0
- lockss/pyclient/rs/models/artifacts_body.py +170 -0
- lockss/pyclient/rs/models/au_size.py +162 -0
- lockss/pyclient/rs/models/auid_page_info.py +140 -0
- lockss/pyclient/rs/models/error_result.py +164 -0
- lockss/pyclient/rs/models/import_status.py +298 -0
- lockss/pyclient/rs/models/page_info.py +229 -0
- lockss/pyclient/rs/models/repository_info.py +164 -0
- lockss/pyclient/rs/models/repository_statistics.py +112 -0
- lockss/pyclient/rs/models/storage_info.py +287 -0
- lockss/pyclient/rs/models/streaming_response_body.py +84 -0
- lockss/pyclient/rs/rest.py +317 -0
- lockss_pyclient-0.1.0.dev1.dist-info/LICENSE +27 -0
- lockss_pyclient-0.1.0.dev1.dist-info/METADATA +29 -0
- lockss_pyclient-0.1.0.dev1.dist-info/RECORD +148 -0
- lockss_pyclient-0.1.0.dev1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
LOCKSS Repository Service REST API
|
|
5
|
+
|
|
6
|
+
REST API of the LOCKSS Repository Service # noqa: E501
|
|
7
|
+
|
|
8
|
+
OpenAPI spec version: 2.0.0
|
|
9
|
+
Contact: lockss-support@lockss.org
|
|
10
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import pprint
|
|
14
|
+
import re # noqa: F401
|
|
15
|
+
|
|
16
|
+
import six
|
|
17
|
+
|
|
18
|
+
class StorageInfo(object):
|
|
19
|
+
"""NOTE: This class is auto generated by the swagger code generator program.
|
|
20
|
+
|
|
21
|
+
Do not edit the class manually.
|
|
22
|
+
"""
|
|
23
|
+
"""
|
|
24
|
+
Attributes:
|
|
25
|
+
swagger_types (dict): The key is attribute name
|
|
26
|
+
and the value is attribute type.
|
|
27
|
+
attribute_map (dict): The key is attribute name
|
|
28
|
+
and the value is json key in definition.
|
|
29
|
+
"""
|
|
30
|
+
swagger_types = {
|
|
31
|
+
'type': 'str',
|
|
32
|
+
'name': 'str',
|
|
33
|
+
'size': 'int',
|
|
34
|
+
'used': 'int',
|
|
35
|
+
'avail': 'int',
|
|
36
|
+
'percent_used_string': 'str',
|
|
37
|
+
'percent_used': 'float'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
attribute_map = {
|
|
41
|
+
'type': 'type',
|
|
42
|
+
'name': 'name',
|
|
43
|
+
'size': 'size',
|
|
44
|
+
'used': 'used',
|
|
45
|
+
'avail': 'avail',
|
|
46
|
+
'percent_used_string': 'percentUsedString',
|
|
47
|
+
'percent_used': 'percentUsed'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
def __init__(self, type=None, name=None, size=None, used=None, avail=None, percent_used_string=None, percent_used=None): # noqa: E501
|
|
51
|
+
"""StorageInfo - a model defined in Swagger""" # noqa: E501
|
|
52
|
+
self._type = None
|
|
53
|
+
self._name = None
|
|
54
|
+
self._size = None
|
|
55
|
+
self._used = None
|
|
56
|
+
self._avail = None
|
|
57
|
+
self._percent_used_string = None
|
|
58
|
+
self._percent_used = None
|
|
59
|
+
self.discriminator = None
|
|
60
|
+
self.type = type
|
|
61
|
+
self.name = name
|
|
62
|
+
self.size = size
|
|
63
|
+
self.used = used
|
|
64
|
+
self.avail = avail
|
|
65
|
+
self.percent_used_string = percent_used_string
|
|
66
|
+
self.percent_used = percent_used
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def type(self):
|
|
70
|
+
"""Gets the type of this StorageInfo. # noqa: E501
|
|
71
|
+
|
|
72
|
+
Type of the storage area # noqa: E501
|
|
73
|
+
|
|
74
|
+
:return: The type of this StorageInfo. # noqa: E501
|
|
75
|
+
:rtype: str
|
|
76
|
+
"""
|
|
77
|
+
return self._type
|
|
78
|
+
|
|
79
|
+
@type.setter
|
|
80
|
+
def type(self, type):
|
|
81
|
+
"""Sets the type of this StorageInfo.
|
|
82
|
+
|
|
83
|
+
Type of the storage area # noqa: E501
|
|
84
|
+
|
|
85
|
+
:param type: The type of this StorageInfo. # noqa: E501
|
|
86
|
+
:type: str
|
|
87
|
+
"""
|
|
88
|
+
if type is None:
|
|
89
|
+
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501
|
|
90
|
+
|
|
91
|
+
self._type = type
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def name(self):
|
|
95
|
+
"""Gets the name of this StorageInfo. # noqa: E501
|
|
96
|
+
|
|
97
|
+
Name of the storage area # noqa: E501
|
|
98
|
+
|
|
99
|
+
:return: The name of this StorageInfo. # noqa: E501
|
|
100
|
+
:rtype: str
|
|
101
|
+
"""
|
|
102
|
+
return self._name
|
|
103
|
+
|
|
104
|
+
@name.setter
|
|
105
|
+
def name(self, name):
|
|
106
|
+
"""Sets the name of this StorageInfo.
|
|
107
|
+
|
|
108
|
+
Name of the storage area # noqa: E501
|
|
109
|
+
|
|
110
|
+
:param name: The name of this StorageInfo. # noqa: E501
|
|
111
|
+
:type: str
|
|
112
|
+
"""
|
|
113
|
+
if name is None:
|
|
114
|
+
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
|
|
115
|
+
|
|
116
|
+
self._name = name
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
def size(self):
|
|
120
|
+
"""Gets the size of this StorageInfo. # noqa: E501
|
|
121
|
+
|
|
122
|
+
Size in bytes of the storage area # noqa: E501
|
|
123
|
+
|
|
124
|
+
:return: The size of this StorageInfo. # noqa: E501
|
|
125
|
+
:rtype: int
|
|
126
|
+
"""
|
|
127
|
+
return self._size
|
|
128
|
+
|
|
129
|
+
@size.setter
|
|
130
|
+
def size(self, size):
|
|
131
|
+
"""Sets the size of this StorageInfo.
|
|
132
|
+
|
|
133
|
+
Size in bytes of the storage area # noqa: E501
|
|
134
|
+
|
|
135
|
+
:param size: The size of this StorageInfo. # noqa: E501
|
|
136
|
+
:type: int
|
|
137
|
+
"""
|
|
138
|
+
if size is None:
|
|
139
|
+
raise ValueError("Invalid value for `size`, must not be `None`") # noqa: E501
|
|
140
|
+
|
|
141
|
+
self._size = size
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def used(self):
|
|
145
|
+
"""Gets the used of this StorageInfo. # noqa: E501
|
|
146
|
+
|
|
147
|
+
Used size in bytes of the storage area # noqa: E501
|
|
148
|
+
|
|
149
|
+
:return: The used of this StorageInfo. # noqa: E501
|
|
150
|
+
:rtype: int
|
|
151
|
+
"""
|
|
152
|
+
return self._used
|
|
153
|
+
|
|
154
|
+
@used.setter
|
|
155
|
+
def used(self, used):
|
|
156
|
+
"""Sets the used of this StorageInfo.
|
|
157
|
+
|
|
158
|
+
Used size in bytes of the storage area # noqa: E501
|
|
159
|
+
|
|
160
|
+
:param used: The used of this StorageInfo. # noqa: E501
|
|
161
|
+
:type: int
|
|
162
|
+
"""
|
|
163
|
+
if used is None:
|
|
164
|
+
raise ValueError("Invalid value for `used`, must not be `None`") # noqa: E501
|
|
165
|
+
|
|
166
|
+
self._used = used
|
|
167
|
+
|
|
168
|
+
@property
|
|
169
|
+
def avail(self):
|
|
170
|
+
"""Gets the avail of this StorageInfo. # noqa: E501
|
|
171
|
+
|
|
172
|
+
Available size in bytes of the storage area # noqa: E501
|
|
173
|
+
|
|
174
|
+
:return: The avail of this StorageInfo. # noqa: E501
|
|
175
|
+
:rtype: int
|
|
176
|
+
"""
|
|
177
|
+
return self._avail
|
|
178
|
+
|
|
179
|
+
@avail.setter
|
|
180
|
+
def avail(self, avail):
|
|
181
|
+
"""Sets the avail of this StorageInfo.
|
|
182
|
+
|
|
183
|
+
Available size in bytes of the storage area # noqa: E501
|
|
184
|
+
|
|
185
|
+
:param avail: The avail of this StorageInfo. # noqa: E501
|
|
186
|
+
:type: int
|
|
187
|
+
"""
|
|
188
|
+
if avail is None:
|
|
189
|
+
raise ValueError("Invalid value for `avail`, must not be `None`") # noqa: E501
|
|
190
|
+
|
|
191
|
+
self._avail = avail
|
|
192
|
+
|
|
193
|
+
@property
|
|
194
|
+
def percent_used_string(self):
|
|
195
|
+
"""Gets the percent_used_string of this StorageInfo. # noqa: E501
|
|
196
|
+
|
|
197
|
+
Percentage of size used, formatted as a string # noqa: E501
|
|
198
|
+
|
|
199
|
+
:return: The percent_used_string of this StorageInfo. # noqa: E501
|
|
200
|
+
:rtype: str
|
|
201
|
+
"""
|
|
202
|
+
return self._percent_used_string
|
|
203
|
+
|
|
204
|
+
@percent_used_string.setter
|
|
205
|
+
def percent_used_string(self, percent_used_string):
|
|
206
|
+
"""Sets the percent_used_string of this StorageInfo.
|
|
207
|
+
|
|
208
|
+
Percentage of size used, formatted as a string # noqa: E501
|
|
209
|
+
|
|
210
|
+
:param percent_used_string: The percent_used_string of this StorageInfo. # noqa: E501
|
|
211
|
+
:type: str
|
|
212
|
+
"""
|
|
213
|
+
if percent_used_string is None:
|
|
214
|
+
raise ValueError("Invalid value for `percent_used_string`, must not be `None`") # noqa: E501
|
|
215
|
+
|
|
216
|
+
self._percent_used_string = percent_used_string
|
|
217
|
+
|
|
218
|
+
@property
|
|
219
|
+
def percent_used(self):
|
|
220
|
+
"""Gets the percent_used of this StorageInfo. # noqa: E501
|
|
221
|
+
|
|
222
|
+
Percentage of size used # noqa: E501
|
|
223
|
+
|
|
224
|
+
:return: The percent_used of this StorageInfo. # noqa: E501
|
|
225
|
+
:rtype: float
|
|
226
|
+
"""
|
|
227
|
+
return self._percent_used
|
|
228
|
+
|
|
229
|
+
@percent_used.setter
|
|
230
|
+
def percent_used(self, percent_used):
|
|
231
|
+
"""Sets the percent_used of this StorageInfo.
|
|
232
|
+
|
|
233
|
+
Percentage of size used # noqa: E501
|
|
234
|
+
|
|
235
|
+
:param percent_used: The percent_used of this StorageInfo. # noqa: E501
|
|
236
|
+
:type: float
|
|
237
|
+
"""
|
|
238
|
+
if percent_used is None:
|
|
239
|
+
raise ValueError("Invalid value for `percent_used`, must not be `None`") # noqa: E501
|
|
240
|
+
|
|
241
|
+
self._percent_used = percent_used
|
|
242
|
+
|
|
243
|
+
def to_dict(self):
|
|
244
|
+
"""Returns the model properties as a dict"""
|
|
245
|
+
result = {}
|
|
246
|
+
|
|
247
|
+
for attr, _ in six.iteritems(self.swagger_types):
|
|
248
|
+
value = getattr(self, attr)
|
|
249
|
+
if isinstance(value, list):
|
|
250
|
+
result[attr] = list(map(
|
|
251
|
+
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
|
252
|
+
value
|
|
253
|
+
))
|
|
254
|
+
elif hasattr(value, "to_dict"):
|
|
255
|
+
result[attr] = value.to_dict()
|
|
256
|
+
elif isinstance(value, dict):
|
|
257
|
+
result[attr] = dict(map(
|
|
258
|
+
lambda item: (item[0], item[1].to_dict())
|
|
259
|
+
if hasattr(item[1], "to_dict") else item,
|
|
260
|
+
value.items()
|
|
261
|
+
))
|
|
262
|
+
else:
|
|
263
|
+
result[attr] = value
|
|
264
|
+
if issubclass(StorageInfo, dict):
|
|
265
|
+
for key, value in self.items():
|
|
266
|
+
result[key] = value
|
|
267
|
+
|
|
268
|
+
return result
|
|
269
|
+
|
|
270
|
+
def to_str(self):
|
|
271
|
+
"""Returns the string representation of the model"""
|
|
272
|
+
return pprint.pformat(self.to_dict())
|
|
273
|
+
|
|
274
|
+
def __repr__(self):
|
|
275
|
+
"""For `print` and `pprint`"""
|
|
276
|
+
return self.to_str()
|
|
277
|
+
|
|
278
|
+
def __eq__(self, other):
|
|
279
|
+
"""Returns true if both objects are equal"""
|
|
280
|
+
if not isinstance(other, StorageInfo):
|
|
281
|
+
return False
|
|
282
|
+
|
|
283
|
+
return self.__dict__ == other.__dict__
|
|
284
|
+
|
|
285
|
+
def __ne__(self, other):
|
|
286
|
+
"""Returns true if both objects are not equal"""
|
|
287
|
+
return not self == other
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
LOCKSS Repository Service REST API
|
|
5
|
+
|
|
6
|
+
REST API of the LOCKSS Repository Service # noqa: E501
|
|
7
|
+
|
|
8
|
+
OpenAPI spec version: 2.0.0
|
|
9
|
+
Contact: lockss-support@lockss.org
|
|
10
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import pprint
|
|
14
|
+
import re # noqa: F401
|
|
15
|
+
|
|
16
|
+
import six
|
|
17
|
+
|
|
18
|
+
class StreamingResponseBody(object):
|
|
19
|
+
"""NOTE: This class is auto generated by the swagger code generator program.
|
|
20
|
+
|
|
21
|
+
Do not edit the class manually.
|
|
22
|
+
"""
|
|
23
|
+
"""
|
|
24
|
+
Attributes:
|
|
25
|
+
swagger_types (dict): The key is attribute name
|
|
26
|
+
and the value is attribute type.
|
|
27
|
+
attribute_map (dict): The key is attribute name
|
|
28
|
+
and the value is json key in definition.
|
|
29
|
+
"""
|
|
30
|
+
swagger_types = {
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
attribute_map = {
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def __init__(self): # noqa: E501
|
|
37
|
+
"""StreamingResponseBody - a model defined in Swagger""" # noqa: E501
|
|
38
|
+
self.discriminator = None
|
|
39
|
+
|
|
40
|
+
def to_dict(self):
|
|
41
|
+
"""Returns the model properties as a dict"""
|
|
42
|
+
result = {}
|
|
43
|
+
|
|
44
|
+
for attr, _ in six.iteritems(self.swagger_types):
|
|
45
|
+
value = getattr(self, attr)
|
|
46
|
+
if isinstance(value, list):
|
|
47
|
+
result[attr] = list(map(
|
|
48
|
+
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
|
49
|
+
value
|
|
50
|
+
))
|
|
51
|
+
elif hasattr(value, "to_dict"):
|
|
52
|
+
result[attr] = value.to_dict()
|
|
53
|
+
elif isinstance(value, dict):
|
|
54
|
+
result[attr] = dict(map(
|
|
55
|
+
lambda item: (item[0], item[1].to_dict())
|
|
56
|
+
if hasattr(item[1], "to_dict") else item,
|
|
57
|
+
value.items()
|
|
58
|
+
))
|
|
59
|
+
else:
|
|
60
|
+
result[attr] = value
|
|
61
|
+
if issubclass(StreamingResponseBody, dict):
|
|
62
|
+
for key, value in self.items():
|
|
63
|
+
result[key] = value
|
|
64
|
+
|
|
65
|
+
return result
|
|
66
|
+
|
|
67
|
+
def to_str(self):
|
|
68
|
+
"""Returns the string representation of the model"""
|
|
69
|
+
return pprint.pformat(self.to_dict())
|
|
70
|
+
|
|
71
|
+
def __repr__(self):
|
|
72
|
+
"""For `print` and `pprint`"""
|
|
73
|
+
return self.to_str()
|
|
74
|
+
|
|
75
|
+
def __eq__(self, other):
|
|
76
|
+
"""Returns true if both objects are equal"""
|
|
77
|
+
if not isinstance(other, StreamingResponseBody):
|
|
78
|
+
return False
|
|
79
|
+
|
|
80
|
+
return self.__dict__ == other.__dict__
|
|
81
|
+
|
|
82
|
+
def __ne__(self, other):
|
|
83
|
+
"""Returns true if both objects are not equal"""
|
|
84
|
+
return not self == other
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
LOCKSS Repository Service REST API
|
|
5
|
+
|
|
6
|
+
REST API of the LOCKSS Repository Service # noqa: E501
|
|
7
|
+
|
|
8
|
+
OpenAPI spec version: 2.0.0
|
|
9
|
+
Contact: lockss-support@lockss.org
|
|
10
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import absolute_import
|
|
14
|
+
|
|
15
|
+
import io
|
|
16
|
+
import json
|
|
17
|
+
import logging
|
|
18
|
+
import re
|
|
19
|
+
import ssl
|
|
20
|
+
|
|
21
|
+
import certifi
|
|
22
|
+
# python 2 and python 3 compatibility library
|
|
23
|
+
import six
|
|
24
|
+
from six.moves.urllib.parse import urlencode
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
import urllib3
|
|
28
|
+
except ImportError:
|
|
29
|
+
raise ImportError('Swagger python client requires urllib3.')
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
logger = logging.getLogger(__name__)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class RESTResponse(io.IOBase):
|
|
36
|
+
|
|
37
|
+
def __init__(self, resp):
|
|
38
|
+
self.urllib3_response = resp
|
|
39
|
+
self.status = resp.status
|
|
40
|
+
self.reason = resp.reason
|
|
41
|
+
self.data = resp.data
|
|
42
|
+
|
|
43
|
+
def getheaders(self):
|
|
44
|
+
"""Returns a dictionary of the response headers."""
|
|
45
|
+
return self.urllib3_response.headers
|
|
46
|
+
|
|
47
|
+
def getheader(self, name, default=None):
|
|
48
|
+
"""Returns a given response header."""
|
|
49
|
+
return self.urllib3_response.headers.get(name, default)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class RESTClientObject(object):
|
|
53
|
+
|
|
54
|
+
def __init__(self, configuration, pools_size=4, maxsize=None):
|
|
55
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
56
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
57
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
58
|
+
# maxsize is the number of requests to host that are allowed in parallel # noqa: E501
|
|
59
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
60
|
+
|
|
61
|
+
# cert_reqs
|
|
62
|
+
if configuration.verify_ssl:
|
|
63
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
64
|
+
else:
|
|
65
|
+
cert_reqs = ssl.CERT_NONE
|
|
66
|
+
|
|
67
|
+
# ca_certs
|
|
68
|
+
if configuration.ssl_ca_cert:
|
|
69
|
+
ca_certs = configuration.ssl_ca_cert
|
|
70
|
+
else:
|
|
71
|
+
# if not set certificate file, use Mozilla's root certificates.
|
|
72
|
+
ca_certs = certifi.where()
|
|
73
|
+
|
|
74
|
+
addition_pool_args = {}
|
|
75
|
+
if configuration.assert_hostname is not None:
|
|
76
|
+
addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
|
|
77
|
+
|
|
78
|
+
if maxsize is None:
|
|
79
|
+
if configuration.connection_pool_maxsize is not None:
|
|
80
|
+
maxsize = configuration.connection_pool_maxsize
|
|
81
|
+
else:
|
|
82
|
+
maxsize = 4
|
|
83
|
+
|
|
84
|
+
# https pool manager
|
|
85
|
+
if configuration.proxy:
|
|
86
|
+
self.pool_manager = urllib3.ProxyManager(
|
|
87
|
+
num_pools=pools_size,
|
|
88
|
+
maxsize=maxsize,
|
|
89
|
+
cert_reqs=cert_reqs,
|
|
90
|
+
ca_certs=ca_certs,
|
|
91
|
+
cert_file=configuration.cert_file,
|
|
92
|
+
key_file=configuration.key_file,
|
|
93
|
+
proxy_url=configuration.proxy,
|
|
94
|
+
**addition_pool_args
|
|
95
|
+
)
|
|
96
|
+
else:
|
|
97
|
+
self.pool_manager = urllib3.PoolManager(
|
|
98
|
+
num_pools=pools_size,
|
|
99
|
+
maxsize=maxsize,
|
|
100
|
+
cert_reqs=cert_reqs,
|
|
101
|
+
ca_certs=ca_certs,
|
|
102
|
+
cert_file=configuration.cert_file,
|
|
103
|
+
key_file=configuration.key_file,
|
|
104
|
+
**addition_pool_args
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
def request(self, method, url, query_params=None, headers=None,
|
|
108
|
+
body=None, post_params=None, _preload_content=True,
|
|
109
|
+
_request_timeout=None):
|
|
110
|
+
"""Perform requests.
|
|
111
|
+
|
|
112
|
+
:param method: http request method
|
|
113
|
+
:param url: http request url
|
|
114
|
+
:param query_params: query parameters in the url
|
|
115
|
+
:param headers: http request headers
|
|
116
|
+
:param body: request json body, for `application/json`
|
|
117
|
+
:param post_params: request post parameters,
|
|
118
|
+
`application/x-www-form-urlencoded`
|
|
119
|
+
and `multipart/form-data`
|
|
120
|
+
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
121
|
+
be returned without reading/decoding response
|
|
122
|
+
data. Default is True.
|
|
123
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
124
|
+
number provided, it will be total request
|
|
125
|
+
timeout. It can also be a pair (tuple) of
|
|
126
|
+
(connection, read) timeouts.
|
|
127
|
+
"""
|
|
128
|
+
method = method.upper()
|
|
129
|
+
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
|
|
130
|
+
'PATCH', 'OPTIONS']
|
|
131
|
+
|
|
132
|
+
if post_params and body:
|
|
133
|
+
raise ValueError(
|
|
134
|
+
"body parameter cannot be used with post_params parameter."
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
post_params = post_params or {}
|
|
138
|
+
headers = headers or {}
|
|
139
|
+
|
|
140
|
+
timeout = None
|
|
141
|
+
if _request_timeout:
|
|
142
|
+
if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821
|
|
143
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
144
|
+
elif (isinstance(_request_timeout, tuple) and
|
|
145
|
+
len(_request_timeout) == 2):
|
|
146
|
+
timeout = urllib3.Timeout(
|
|
147
|
+
connect=_request_timeout[0], read=_request_timeout[1])
|
|
148
|
+
|
|
149
|
+
if 'Content-Type' not in headers:
|
|
150
|
+
headers['Content-Type'] = 'application/json'
|
|
151
|
+
|
|
152
|
+
try:
|
|
153
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
154
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
|
155
|
+
if query_params:
|
|
156
|
+
url += '?' + urlencode(query_params)
|
|
157
|
+
if re.search('json', headers['Content-Type'], re.IGNORECASE):
|
|
158
|
+
request_body = '{}'
|
|
159
|
+
if body is not None:
|
|
160
|
+
request_body = json.dumps(body)
|
|
161
|
+
r = self.pool_manager.request(
|
|
162
|
+
method, url,
|
|
163
|
+
body=request_body,
|
|
164
|
+
preload_content=_preload_content,
|
|
165
|
+
timeout=timeout,
|
|
166
|
+
headers=headers)
|
|
167
|
+
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
|
|
168
|
+
r = self.pool_manager.request(
|
|
169
|
+
method, url,
|
|
170
|
+
fields=post_params,
|
|
171
|
+
encode_multipart=False,
|
|
172
|
+
preload_content=_preload_content,
|
|
173
|
+
timeout=timeout,
|
|
174
|
+
headers=headers)
|
|
175
|
+
elif headers['Content-Type'] == 'multipart/form-data':
|
|
176
|
+
# must del headers['Content-Type'], or the correct
|
|
177
|
+
# Content-Type which generated by urllib3 will be
|
|
178
|
+
# overwritten.
|
|
179
|
+
del headers['Content-Type']
|
|
180
|
+
r = self.pool_manager.request(
|
|
181
|
+
method, url,
|
|
182
|
+
fields=post_params,
|
|
183
|
+
encode_multipart=True,
|
|
184
|
+
preload_content=_preload_content,
|
|
185
|
+
timeout=timeout,
|
|
186
|
+
headers=headers)
|
|
187
|
+
# Pass a `string` parameter directly in the body to support
|
|
188
|
+
# other content types than Json when `body` argument is
|
|
189
|
+
# provided in serialized form
|
|
190
|
+
elif isinstance(body, str):
|
|
191
|
+
request_body = body
|
|
192
|
+
r = self.pool_manager.request(
|
|
193
|
+
method, url,
|
|
194
|
+
body=request_body,
|
|
195
|
+
preload_content=_preload_content,
|
|
196
|
+
timeout=timeout,
|
|
197
|
+
headers=headers)
|
|
198
|
+
else:
|
|
199
|
+
# Cannot generate the request from given parameters
|
|
200
|
+
msg = """Cannot prepare a request message for provided
|
|
201
|
+
arguments. Please check that your arguments match
|
|
202
|
+
declared content type."""
|
|
203
|
+
raise ApiException(status=0, reason=msg)
|
|
204
|
+
# For `GET`, `HEAD`
|
|
205
|
+
else:
|
|
206
|
+
r = self.pool_manager.request(method, url,
|
|
207
|
+
fields=query_params,
|
|
208
|
+
preload_content=_preload_content,
|
|
209
|
+
timeout=timeout,
|
|
210
|
+
headers=headers)
|
|
211
|
+
except urllib3.exceptions.SSLError as e:
|
|
212
|
+
msg = "{0}\n{1}".format(type(e).__name__, str(e))
|
|
213
|
+
raise ApiException(status=0, reason=msg)
|
|
214
|
+
|
|
215
|
+
if _preload_content:
|
|
216
|
+
r = RESTResponse(r)
|
|
217
|
+
|
|
218
|
+
# log response body
|
|
219
|
+
logger.debug("response body: %s", r.data)
|
|
220
|
+
|
|
221
|
+
if not 200 <= r.status <= 299:
|
|
222
|
+
raise ApiException(http_resp=r)
|
|
223
|
+
|
|
224
|
+
return r
|
|
225
|
+
|
|
226
|
+
def GET(self, url, headers=None, query_params=None, _preload_content=True,
|
|
227
|
+
_request_timeout=None):
|
|
228
|
+
return self.request("GET", url,
|
|
229
|
+
headers=headers,
|
|
230
|
+
_preload_content=_preload_content,
|
|
231
|
+
_request_timeout=_request_timeout,
|
|
232
|
+
query_params=query_params)
|
|
233
|
+
|
|
234
|
+
def HEAD(self, url, headers=None, query_params=None, _preload_content=True,
|
|
235
|
+
_request_timeout=None):
|
|
236
|
+
return self.request("HEAD", url,
|
|
237
|
+
headers=headers,
|
|
238
|
+
_preload_content=_preload_content,
|
|
239
|
+
_request_timeout=_request_timeout,
|
|
240
|
+
query_params=query_params)
|
|
241
|
+
|
|
242
|
+
def OPTIONS(self, url, headers=None, query_params=None, post_params=None,
|
|
243
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
244
|
+
return self.request("OPTIONS", url,
|
|
245
|
+
headers=headers,
|
|
246
|
+
query_params=query_params,
|
|
247
|
+
post_params=post_params,
|
|
248
|
+
_preload_content=_preload_content,
|
|
249
|
+
_request_timeout=_request_timeout,
|
|
250
|
+
body=body)
|
|
251
|
+
|
|
252
|
+
def DELETE(self, url, headers=None, query_params=None, body=None,
|
|
253
|
+
_preload_content=True, _request_timeout=None):
|
|
254
|
+
return self.request("DELETE", url,
|
|
255
|
+
headers=headers,
|
|
256
|
+
query_params=query_params,
|
|
257
|
+
_preload_content=_preload_content,
|
|
258
|
+
_request_timeout=_request_timeout,
|
|
259
|
+
body=body)
|
|
260
|
+
|
|
261
|
+
def POST(self, url, headers=None, query_params=None, post_params=None,
|
|
262
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
263
|
+
return self.request("POST", url,
|
|
264
|
+
headers=headers,
|
|
265
|
+
query_params=query_params,
|
|
266
|
+
post_params=post_params,
|
|
267
|
+
_preload_content=_preload_content,
|
|
268
|
+
_request_timeout=_request_timeout,
|
|
269
|
+
body=body)
|
|
270
|
+
|
|
271
|
+
def PUT(self, url, headers=None, query_params=None, post_params=None,
|
|
272
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
273
|
+
return self.request("PUT", url,
|
|
274
|
+
headers=headers,
|
|
275
|
+
query_params=query_params,
|
|
276
|
+
post_params=post_params,
|
|
277
|
+
_preload_content=_preload_content,
|
|
278
|
+
_request_timeout=_request_timeout,
|
|
279
|
+
body=body)
|
|
280
|
+
|
|
281
|
+
def PATCH(self, url, headers=None, query_params=None, post_params=None,
|
|
282
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
283
|
+
return self.request("PATCH", url,
|
|
284
|
+
headers=headers,
|
|
285
|
+
query_params=query_params,
|
|
286
|
+
post_params=post_params,
|
|
287
|
+
_preload_content=_preload_content,
|
|
288
|
+
_request_timeout=_request_timeout,
|
|
289
|
+
body=body)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
class ApiException(Exception):
|
|
293
|
+
|
|
294
|
+
def __init__(self, status=None, reason=None, http_resp=None):
|
|
295
|
+
if http_resp:
|
|
296
|
+
self.status = http_resp.status
|
|
297
|
+
self.reason = http_resp.reason
|
|
298
|
+
self.body = http_resp.data
|
|
299
|
+
self.headers = http_resp.getheaders()
|
|
300
|
+
else:
|
|
301
|
+
self.status = status
|
|
302
|
+
self.reason = reason
|
|
303
|
+
self.body = None
|
|
304
|
+
self.headers = None
|
|
305
|
+
|
|
306
|
+
def __str__(self):
|
|
307
|
+
"""Custom error messages for exception"""
|
|
308
|
+
error_message = "({0})\n"\
|
|
309
|
+
"Reason: {1}\n".format(self.status, self.reason)
|
|
310
|
+
if self.headers:
|
|
311
|
+
error_message += "HTTP response headers: {0}\n".format(
|
|
312
|
+
self.headers)
|
|
313
|
+
|
|
314
|
+
if self.body:
|
|
315
|
+
error_message += "HTTP response body: {0}\n".format(self.body)
|
|
316
|
+
|
|
317
|
+
return error_message
|