pulp_file_client 0.1.0b1 → 0.1.0b2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/docs/ContentFilesApi.md +12 -6
- data/docs/DistributionsFileApi.md +12 -6
- data/docs/FileContent.md +4 -4
- data/docs/InlineResponse200.md +3 -3
- data/docs/InlineResponse2001.md +3 -3
- data/docs/InlineResponse2002.md +3 -3
- data/docs/InlineResponse2003.md +3 -3
- data/docs/PublicationsFileApi.md +12 -6
- data/docs/RemotesFileApi.md +12 -6
- data/git_push.sh +10 -7
- data/lib/pulp_file_client/api/content_files_api.rb +15 -9
- data/lib/pulp_file_client/api/distributions_file_api.rb +18 -12
- data/lib/pulp_file_client/api/publications_file_api.rb +16 -10
- data/lib/pulp_file_client/api/remotes_file_api.rb +19 -13
- data/lib/pulp_file_client/api_client.rb +77 -62
- data/lib/pulp_file_client/api_error.rb +1 -1
- data/lib/pulp_file_client/configuration.rb +13 -21
- data/lib/pulp_file_client/models/async_operation_response.rb +1 -1
- data/lib/pulp_file_client/models/file_content.rb +19 -19
- data/lib/pulp_file_client/models/file_distribution.rb +1 -1
- data/lib/pulp_file_client/models/file_publication.rb +1 -1
- data/lib/pulp_file_client/models/file_remote.rb +1 -1
- data/lib/pulp_file_client/models/inline_response200.rb +11 -11
- data/lib/pulp_file_client/models/inline_response2001.rb +11 -11
- data/lib/pulp_file_client/models/inline_response2002.rb +11 -11
- data/lib/pulp_file_client/models/inline_response2003.rb +11 -11
- data/lib/pulp_file_client/models/repository_sync_url.rb +1 -1
- data/lib/pulp_file_client/version.rb +2 -2
- data/lib/pulp_file_client.rb +1 -1
- data/pulp_file_client.gemspec +3 -9
- data/spec/api/content_files_api_spec.rb +5 -3
- data/spec/api/distributions_file_api_spec.rb +5 -3
- data/spec/api/publications_file_api_spec.rb +5 -3
- data/spec/api/remotes_file_api_spec.rb +5 -3
- data/spec/api_client_spec.rb +1 -39
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/async_operation_response_spec.rb +1 -1
- data/spec/models/file_content_spec.rb +3 -3
- data/spec/models/file_distribution_spec.rb +1 -1
- data/spec/models/file_publication_spec.rb +1 -1
- data/spec/models/file_remote_spec.rb +1 -1
- data/spec/models/inline_response2001_spec.rb +4 -4
- data/spec/models/inline_response2002_spec.rb +4 -4
- data/spec/models/inline_response2003_spec.rb +4 -4
- data/spec/models/inline_response200_spec.rb +4 -4
- data/spec/models/repository_sync_url_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +6 -133
- data/Gemfile.lock +0 -79
@@ -6,11 +6,11 @@
|
|
6
6
|
The version of the OpenAPI document: v3
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.1.3-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require '
|
13
|
+
require 'cgi'
|
14
14
|
|
15
15
|
module PulpFileClient
|
16
16
|
class PublicationsFileApi
|
@@ -107,7 +107,7 @@ module PulpFileClient
|
|
107
107
|
fail ArgumentError, "Missing the required parameter 'file_publication_href' when calling PublicationsFileApi.delete"
|
108
108
|
end
|
109
109
|
# resource path
|
110
|
-
local_var_path = '{file_publication_href}'.sub('{' + 'file_publication_href' + '}', file_publication_href.to_s)
|
110
|
+
local_var_path = '{file_publication_href}'.sub('{' + 'file_publication_href' + '}', CGI.escape(file_publication_href.to_s).gsub('%2F', '/'))
|
111
111
|
|
112
112
|
# query parameters
|
113
113
|
query_params = opts[:query_params] || {}
|
@@ -147,8 +147,9 @@ module PulpFileClient
|
|
147
147
|
# <!-- User-facing documentation, rendered as html--> A FilePublication contains metadata about all the <a href=\"#operation/content_file_files_list\">File Content</a> in a particular <a href=\"https://docs.pulpproject.org/en/3.0/nightly/restapi.html#operation/repositories_versions_list\">Repository Version.</a> Once a FilePublication has been created, it can be hosted using the <a href=\"#operation/distributions_file_file_list\">File Distribution API.</a>
|
148
148
|
# @param [Hash] opts the optional parameters
|
149
149
|
# @option opts [String] :ordering Which field to use when ordering the results.
|
150
|
-
# @option opts [Integer] :
|
151
|
-
# @option opts [Integer] :
|
150
|
+
# @option opts [Integer] :limit Number of results to return per page.
|
151
|
+
# @option opts [Integer] :offset The initial index from which to return the results.
|
152
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
152
153
|
# @return [InlineResponse2002]
|
153
154
|
def list(opts = {})
|
154
155
|
data, _status_code, _headers = list_with_http_info(opts)
|
@@ -159,8 +160,9 @@ module PulpFileClient
|
|
159
160
|
# <!-- User-facing documentation, rendered as html--> A FilePublication contains metadata about all the <a href=\"#operation/content_file_files_list\">File Content</a> in a particular <a href=\"https://docs.pulpproject.org/en/3.0/nightly/restapi.html#operation/repositories_versions_list\">Repository Version.</a> Once a FilePublication has been created, it can be hosted using the <a href=\"#operation/distributions_file_file_list\">File Distribution API.</a>
|
160
161
|
# @param [Hash] opts the optional parameters
|
161
162
|
# @option opts [String] :ordering Which field to use when ordering the results.
|
162
|
-
# @option opts [Integer] :
|
163
|
-
# @option opts [Integer] :
|
163
|
+
# @option opts [Integer] :limit Number of results to return per page.
|
164
|
+
# @option opts [Integer] :offset The initial index from which to return the results.
|
165
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
164
166
|
# @return [Array<(InlineResponse2002, Integer, Hash)>] InlineResponse2002 data, response status code and response headers
|
165
167
|
def list_with_http_info(opts = {})
|
166
168
|
if @api_client.config.debugging
|
@@ -172,8 +174,9 @@ module PulpFileClient
|
|
172
174
|
# query parameters
|
173
175
|
query_params = opts[:query_params] || {}
|
174
176
|
query_params[:'ordering'] = opts[:'ordering'] if !opts[:'ordering'].nil?
|
175
|
-
query_params[:'
|
176
|
-
query_params[:'
|
177
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
178
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
179
|
+
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
|
177
180
|
|
178
181
|
# header parameters
|
179
182
|
header_params = opts[:header_params] || {}
|
@@ -212,6 +215,7 @@ module PulpFileClient
|
|
212
215
|
# <!-- User-facing documentation, rendered as html--> A FilePublication contains metadata about all the <a href=\"#operation/content_file_files_list\">File Content</a> in a particular <a href=\"https://docs.pulpproject.org/en/3.0/nightly/restapi.html#operation/repositories_versions_list\">Repository Version.</a> Once a FilePublication has been created, it can be hosted using the <a href=\"#operation/distributions_file_file_list\">File Distribution API.</a>
|
213
216
|
# @param file_publication_href [String] URI of File Publication. e.g.: /pulp/api/v3/publications/file/file/1/
|
214
217
|
# @param [Hash] opts the optional parameters
|
218
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
215
219
|
# @return [FilePublication]
|
216
220
|
def read(file_publication_href, opts = {})
|
217
221
|
data, _status_code, _headers = read_with_http_info(file_publication_href, opts)
|
@@ -222,6 +226,7 @@ module PulpFileClient
|
|
222
226
|
# <!-- User-facing documentation, rendered as html--> A FilePublication contains metadata about all the <a href=\"#operation/content_file_files_list\">File Content</a> in a particular <a href=\"https://docs.pulpproject.org/en/3.0/nightly/restapi.html#operation/repositories_versions_list\">Repository Version.</a> Once a FilePublication has been created, it can be hosted using the <a href=\"#operation/distributions_file_file_list\">File Distribution API.</a>
|
223
227
|
# @param file_publication_href [String] URI of File Publication. e.g.: /pulp/api/v3/publications/file/file/1/
|
224
228
|
# @param [Hash] opts the optional parameters
|
229
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
225
230
|
# @return [Array<(FilePublication, Integer, Hash)>] FilePublication data, response status code and response headers
|
226
231
|
def read_with_http_info(file_publication_href, opts = {})
|
227
232
|
if @api_client.config.debugging
|
@@ -232,10 +237,11 @@ module PulpFileClient
|
|
232
237
|
fail ArgumentError, "Missing the required parameter 'file_publication_href' when calling PublicationsFileApi.read"
|
233
238
|
end
|
234
239
|
# resource path
|
235
|
-
local_var_path = '{file_publication_href}'.sub('{' + 'file_publication_href' + '}', file_publication_href.to_s)
|
240
|
+
local_var_path = '{file_publication_href}'.sub('{' + 'file_publication_href' + '}', CGI.escape(file_publication_href.to_s).gsub('%2F', '/'))
|
236
241
|
|
237
242
|
# query parameters
|
238
243
|
query_params = opts[:query_params] || {}
|
244
|
+
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
|
239
245
|
|
240
246
|
# header parameters
|
241
247
|
header_params = opts[:header_params] || {}
|
@@ -6,11 +6,11 @@
|
|
6
6
|
The version of the OpenAPI document: v3
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.1.3-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require '
|
13
|
+
require 'cgi'
|
14
14
|
|
15
15
|
module PulpFileClient
|
16
16
|
class RemotesFileApi
|
@@ -107,7 +107,7 @@ module PulpFileClient
|
|
107
107
|
fail ArgumentError, "Missing the required parameter 'file_remote_href' when calling RemotesFileApi.delete"
|
108
108
|
end
|
109
109
|
# resource path
|
110
|
-
local_var_path = '{file_remote_href}'.sub('{' + 'file_remote_href' + '}', file_remote_href.to_s)
|
110
|
+
local_var_path = '{file_remote_href}'.sub('{' + 'file_remote_href' + '}', CGI.escape(file_remote_href.to_s).gsub('%2F', '/'))
|
111
111
|
|
112
112
|
# query parameters
|
113
113
|
query_params = opts[:query_params] || {}
|
@@ -156,8 +156,9 @@ module PulpFileClient
|
|
156
156
|
# @option opts [String] :_last_updated__gte Filter results where _last_updated is greater than or equal to value
|
157
157
|
# @option opts [String] :_last_updated__range Filter results where _last_updated is between two comma separated values
|
158
158
|
# @option opts [String] :_last_updated ISO 8601 formatted dates are supported
|
159
|
-
# @option opts [Integer] :
|
160
|
-
# @option opts [Integer] :
|
159
|
+
# @option opts [Integer] :limit Number of results to return per page.
|
160
|
+
# @option opts [Integer] :offset The initial index from which to return the results.
|
161
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
161
162
|
# @return [InlineResponse2003]
|
162
163
|
def list(opts = {})
|
163
164
|
data, _status_code, _headers = list_with_http_info(opts)
|
@@ -175,8 +176,9 @@ module PulpFileClient
|
|
175
176
|
# @option opts [String] :_last_updated__gte Filter results where _last_updated is greater than or equal to value
|
176
177
|
# @option opts [String] :_last_updated__range Filter results where _last_updated is between two comma separated values
|
177
178
|
# @option opts [String] :_last_updated ISO 8601 formatted dates are supported
|
178
|
-
# @option opts [Integer] :
|
179
|
-
# @option opts [Integer] :
|
179
|
+
# @option opts [Integer] :limit Number of results to return per page.
|
180
|
+
# @option opts [Integer] :offset The initial index from which to return the results.
|
181
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
180
182
|
# @return [Array<(InlineResponse2003, Integer, Hash)>] InlineResponse2003 data, response status code and response headers
|
181
183
|
def list_with_http_info(opts = {})
|
182
184
|
if @api_client.config.debugging
|
@@ -195,8 +197,9 @@ module PulpFileClient
|
|
195
197
|
query_params[:'_last_updated__gte'] = opts[:'_last_updated__gte'] if !opts[:'_last_updated__gte'].nil?
|
196
198
|
query_params[:'_last_updated__range'] = opts[:'_last_updated__range'] if !opts[:'_last_updated__range'].nil?
|
197
199
|
query_params[:'_last_updated'] = opts[:'_last_updated'] if !opts[:'_last_updated'].nil?
|
198
|
-
query_params[:'
|
199
|
-
query_params[:'
|
200
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
201
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
202
|
+
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
|
200
203
|
|
201
204
|
# header parameters
|
202
205
|
header_params = opts[:header_params] || {}
|
@@ -261,7 +264,7 @@ module PulpFileClient
|
|
261
264
|
fail ArgumentError, "Missing the required parameter 'data' when calling RemotesFileApi.partial_update"
|
262
265
|
end
|
263
266
|
# resource path
|
264
|
-
local_var_path = '{file_remote_href}'.sub('{' + 'file_remote_href' + '}', file_remote_href.to_s)
|
267
|
+
local_var_path = '{file_remote_href}'.sub('{' + 'file_remote_href' + '}', CGI.escape(file_remote_href.to_s).gsub('%2F', '/'))
|
265
268
|
|
266
269
|
# query parameters
|
267
270
|
query_params = opts[:query_params] || {}
|
@@ -305,6 +308,7 @@ module PulpFileClient
|
|
305
308
|
# <!-- User-facing documentation, rendered as html--> FileRemote represents an external source of <a href=\"#operation/content_file_files_list\">File Content</a>. The target url of a FileRemote must contain a file manifest, which contains the metadata for all files at the source.
|
306
309
|
# @param file_remote_href [String] URI of File Remote. e.g.: /pulp/api/v3/remotes/file/file/1/
|
307
310
|
# @param [Hash] opts the optional parameters
|
311
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
308
312
|
# @return [FileRemote]
|
309
313
|
def read(file_remote_href, opts = {})
|
310
314
|
data, _status_code, _headers = read_with_http_info(file_remote_href, opts)
|
@@ -315,6 +319,7 @@ module PulpFileClient
|
|
315
319
|
# <!-- User-facing documentation, rendered as html--> FileRemote represents an external source of <a href=\"#operation/content_file_files_list\">File Content</a>. The target url of a FileRemote must contain a file manifest, which contains the metadata for all files at the source.
|
316
320
|
# @param file_remote_href [String] URI of File Remote. e.g.: /pulp/api/v3/remotes/file/file/1/
|
317
321
|
# @param [Hash] opts the optional parameters
|
322
|
+
# @option opts [String] :fields A list of fields to include in the response.
|
318
323
|
# @return [Array<(FileRemote, Integer, Hash)>] FileRemote data, response status code and response headers
|
319
324
|
def read_with_http_info(file_remote_href, opts = {})
|
320
325
|
if @api_client.config.debugging
|
@@ -325,10 +330,11 @@ module PulpFileClient
|
|
325
330
|
fail ArgumentError, "Missing the required parameter 'file_remote_href' when calling RemotesFileApi.read"
|
326
331
|
end
|
327
332
|
# resource path
|
328
|
-
local_var_path = '{file_remote_href}'.sub('{' + 'file_remote_href' + '}', file_remote_href.to_s)
|
333
|
+
local_var_path = '{file_remote_href}'.sub('{' + 'file_remote_href' + '}', CGI.escape(file_remote_href.to_s).gsub('%2F', '/'))
|
329
334
|
|
330
335
|
# query parameters
|
331
336
|
query_params = opts[:query_params] || {}
|
337
|
+
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
|
332
338
|
|
333
339
|
# header parameters
|
334
340
|
header_params = opts[:header_params] || {}
|
@@ -391,7 +397,7 @@ module PulpFileClient
|
|
391
397
|
fail ArgumentError, "Missing the required parameter 'data' when calling RemotesFileApi.sync"
|
392
398
|
end
|
393
399
|
# resource path
|
394
|
-
local_var_path = '{file_remote_href}sync/'.sub('{' + 'file_remote_href' + '}', file_remote_href.to_s)
|
400
|
+
local_var_path = '{file_remote_href}sync/'.sub('{' + 'file_remote_href' + '}', CGI.escape(file_remote_href.to_s).gsub('%2F', '/'))
|
395
401
|
|
396
402
|
# query parameters
|
397
403
|
query_params = opts[:query_params] || {}
|
@@ -461,7 +467,7 @@ module PulpFileClient
|
|
461
467
|
fail ArgumentError, "Missing the required parameter 'data' when calling RemotesFileApi.update"
|
462
468
|
end
|
463
469
|
# resource path
|
464
|
-
local_var_path = '{file_remote_href}'.sub('{' + 'file_remote_href' + '}', file_remote_href.to_s)
|
470
|
+
local_var_path = '{file_remote_href}'.sub('{' + 'file_remote_href' + '}', CGI.escape(file_remote_href.to_s).gsub('%2F', '/'))
|
465
471
|
|
466
472
|
# query parameters
|
467
473
|
query_params = opts[:query_params] || {}
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: v3
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.1.3-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -14,8 +14,7 @@ require 'date'
|
|
14
14
|
require 'json'
|
15
15
|
require 'logger'
|
16
16
|
require 'tempfile'
|
17
|
-
require '
|
18
|
-
require 'uri'
|
17
|
+
require 'faraday'
|
19
18
|
|
20
19
|
module PulpFileClient
|
21
20
|
class ApiClient
|
@@ -47,26 +46,46 @@ module PulpFileClient
|
|
47
46
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
48
47
|
# the data deserialized from response body (could be nil), response status code and response headers.
|
49
48
|
def call_api(http_method, path, opts = {})
|
50
|
-
|
51
|
-
|
49
|
+
ssl_options = {
|
50
|
+
:ca_file => @config.ssl_ca_file,
|
51
|
+
:verify => @config.ssl_verify,
|
52
|
+
:verify_mode => @config.ssl_verify_mode,
|
53
|
+
:client_cert => @config.ssl_client_cert,
|
54
|
+
:client_key => @config.ssl_client_key
|
55
|
+
}
|
52
56
|
|
53
|
-
|
54
|
-
|
57
|
+
connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn|
|
58
|
+
conn.basic_auth(config.username, config.password)
|
59
|
+
if opts[:header_params]["Content-Type"] == "multipart/form-data"
|
60
|
+
conn.request :multipart
|
61
|
+
conn.request :url_encoded
|
62
|
+
end
|
63
|
+
conn.adapter(Faraday.default_adapter)
|
55
64
|
end
|
56
65
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
begin
|
67
|
+
response = connection.public_send(http_method.to_sym.downcase) do |req|
|
68
|
+
build_request(http_method, path, req, opts)
|
69
|
+
end
|
70
|
+
|
71
|
+
if @config.debugging
|
72
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
73
|
+
end
|
74
|
+
|
75
|
+
unless response.success?
|
76
|
+
if response.status == 0
|
77
|
+
# Errors from libcurl will be made visible here
|
78
|
+
fail ApiError.new(:code => 0,
|
79
|
+
:message => response.return_message)
|
80
|
+
else
|
81
|
+
fail ApiError.new(:code => response.status,
|
82
|
+
:response_headers => response.headers,
|
83
|
+
:response_body => response.body),
|
84
|
+
response.reason_phrase
|
85
|
+
end
|
69
86
|
end
|
87
|
+
rescue Faraday::TimeoutError
|
88
|
+
fail ApiError.new('Connection timed out')
|
70
89
|
end
|
71
90
|
|
72
91
|
if opts[:return_type]
|
@@ -74,7 +93,7 @@ module PulpFileClient
|
|
74
93
|
else
|
75
94
|
data = nil
|
76
95
|
end
|
77
|
-
return data, response.
|
96
|
+
return data, response.status, response.headers
|
78
97
|
end
|
79
98
|
|
80
99
|
# Builds the HTTP request
|
@@ -86,7 +105,7 @@ module PulpFileClient
|
|
86
105
|
# @option opts [Hash] :form_params Query parameters
|
87
106
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
88
107
|
# @return [Typhoeus::Request] A Typhoeus Request
|
89
|
-
def build_request(http_method, path, opts = {})
|
108
|
+
def build_request(http_method, path, request, opts = {})
|
90
109
|
url = build_request_url(path)
|
91
110
|
http_method = http_method.to_sym.downcase
|
92
111
|
|
@@ -96,25 +115,15 @@ module PulpFileClient
|
|
96
115
|
|
97
116
|
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
98
117
|
|
99
|
-
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
100
|
-
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
101
|
-
|
102
118
|
req_opts = {
|
103
119
|
:method => http_method,
|
104
120
|
:headers => header_params,
|
105
121
|
:params => query_params,
|
106
122
|
:params_encoding => @config.params_encoding,
|
107
123
|
:timeout => @config.timeout,
|
108
|
-
:ssl_verifypeer => @config.verify_ssl,
|
109
|
-
:ssl_verifyhost => _verify_ssl_host,
|
110
|
-
:sslcert => @config.cert_file,
|
111
|
-
:sslkey => @config.key_file,
|
112
124
|
:verbose => @config.debugging
|
113
125
|
}
|
114
126
|
|
115
|
-
# set custom cert, if provided
|
116
|
-
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
117
|
-
|
118
127
|
if [:post, :patch, :put, :delete].include?(http_method)
|
119
128
|
req_body = build_request_body(header_params, form_params, opts[:body])
|
120
129
|
req_opts.update :body => req_body
|
@@ -122,12 +131,46 @@ module PulpFileClient
|
|
122
131
|
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
123
132
|
end
|
124
133
|
end
|
125
|
-
|
126
|
-
request =
|
134
|
+
request.headers = header_params
|
135
|
+
request.body = req_body
|
136
|
+
request.url url
|
137
|
+
request.params = query_params
|
127
138
|
download_file(request) if opts[:return_type] == 'File'
|
128
139
|
request
|
129
140
|
end
|
130
141
|
|
142
|
+
# Builds the HTTP request body
|
143
|
+
#
|
144
|
+
# @param [Hash] header_params Header parameters
|
145
|
+
# @param [Hash] form_params Query parameters
|
146
|
+
# @param [Object] body HTTP body (JSON/XML)
|
147
|
+
# @return [String] HTTP body data in the form of string
|
148
|
+
def build_request_body(header_params, form_params, body)
|
149
|
+
# http form
|
150
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
|
151
|
+
data = URI.encode_www_form(form_params)
|
152
|
+
elsif header_params['Content-Type'] == 'multipart/form-data'
|
153
|
+
data = {}
|
154
|
+
form_params.each do |key, value|
|
155
|
+
case value
|
156
|
+
when ::File, ::Tempfile
|
157
|
+
# TODO hardcode to application/octet-stream, need better way to detect content type
|
158
|
+
data[key] = Faraday::UploadIO.new(value.path, 'application/octet-stream', value.path)
|
159
|
+
when ::Array, nil
|
160
|
+
# let Faraday handle Array and nil parameters
|
161
|
+
data[key] = value
|
162
|
+
else
|
163
|
+
data[key] = value.to_s
|
164
|
+
end
|
165
|
+
end
|
166
|
+
elsif body
|
167
|
+
data = body.is_a?(String) ? body : body.to_json
|
168
|
+
else
|
169
|
+
data = nil
|
170
|
+
end
|
171
|
+
data
|
172
|
+
end
|
173
|
+
|
131
174
|
# Check if the given MIME is a JSON MIME.
|
132
175
|
# JSON MIME examples:
|
133
176
|
# application/json
|
@@ -262,35 +305,7 @@ module PulpFileClient
|
|
262
305
|
def build_request_url(path)
|
263
306
|
# Add leading and trailing slashes to path
|
264
307
|
path = "/#{path}".gsub(/\/+/, '/')
|
265
|
-
|
266
|
-
end
|
267
|
-
|
268
|
-
# Builds the HTTP request body
|
269
|
-
#
|
270
|
-
# @param [Hash] header_params Header parameters
|
271
|
-
# @param [Hash] form_params Query parameters
|
272
|
-
# @param [Object] body HTTP body (JSON/XML)
|
273
|
-
# @return [String] HTTP body data in the form of string
|
274
|
-
def build_request_body(header_params, form_params, body)
|
275
|
-
# http form
|
276
|
-
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
277
|
-
header_params['Content-Type'] == 'multipart/form-data'
|
278
|
-
data = {}
|
279
|
-
form_params.each do |key, value|
|
280
|
-
case value
|
281
|
-
when ::File, ::Array, nil
|
282
|
-
# let typhoeus handle File, Array and nil parameters
|
283
|
-
data[key] = value
|
284
|
-
else
|
285
|
-
data[key] = value.to_s
|
286
|
-
end
|
287
|
-
end
|
288
|
-
elsif body
|
289
|
-
data = body.is_a?(String) ? body : body.to_json
|
290
|
-
else
|
291
|
-
data = nil
|
292
|
-
end
|
293
|
-
data
|
308
|
+
@config.base_url + path
|
294
309
|
end
|
295
310
|
|
296
311
|
# Update hearder and query params based on authentication settings.
|
@@ -6,12 +6,10 @@
|
|
6
6
|
The version of the OpenAPI document: v3
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.1.3-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require 'uri'
|
14
|
-
|
15
13
|
module PulpFileClient
|
16
14
|
class Configuration
|
17
15
|
# Defines url scheme
|
@@ -88,33 +86,28 @@ module PulpFileClient
|
|
88
86
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
89
87
|
#
|
90
88
|
# @return [true, false]
|
91
|
-
attr_accessor :
|
89
|
+
attr_accessor :ssl_verify
|
92
90
|
|
93
91
|
### TLS/SSL setting
|
94
|
-
#
|
95
|
-
# Default to true.
|
92
|
+
# Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
|
96
93
|
#
|
97
94
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
98
95
|
#
|
99
|
-
|
100
|
-
attr_accessor :verify_ssl_host
|
96
|
+
attr_accessor :ssl_verify_mode
|
101
97
|
|
102
98
|
### TLS/SSL setting
|
103
99
|
# Set this to customize the certificate file to verify the peer.
|
104
100
|
#
|
105
101
|
# @return [String] the path to the certificate file
|
106
|
-
|
107
|
-
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
108
|
-
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
109
|
-
attr_accessor :ssl_ca_cert
|
102
|
+
attr_accessor :ssl_ca_file
|
110
103
|
|
111
104
|
### TLS/SSL setting
|
112
105
|
# Client certificate file (for client certificate)
|
113
|
-
attr_accessor :
|
106
|
+
attr_accessor :ssl_client_cert
|
114
107
|
|
115
108
|
### TLS/SSL setting
|
116
109
|
# Client private key file (for client certificate)
|
117
|
-
attr_accessor :
|
110
|
+
attr_accessor :ssl_client_key
|
118
111
|
|
119
112
|
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
120
113
|
# Default to nil.
|
@@ -135,11 +128,11 @@ module PulpFileClient
|
|
135
128
|
@api_key_prefix = {}
|
136
129
|
@timeout = 0
|
137
130
|
@client_side_validation = true
|
138
|
-
@
|
139
|
-
@
|
140
|
-
@
|
141
|
-
@
|
142
|
-
@
|
131
|
+
@ssl_verify = true
|
132
|
+
@ssl_verify_mode = nil
|
133
|
+
@ssl_ca_file = nil
|
134
|
+
@ssl_client_cert = nil
|
135
|
+
@ssl_client_key = nil
|
143
136
|
@debugging = false
|
144
137
|
@inject_format = false
|
145
138
|
@force_ending_format = false
|
@@ -174,8 +167,7 @@ module PulpFileClient
|
|
174
167
|
end
|
175
168
|
|
176
169
|
def base_url
|
177
|
-
|
178
|
-
URI.encode(url)
|
170
|
+
"#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
179
171
|
end
|
180
172
|
|
181
173
|
# Gets API key (with prefix if set).
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: v3
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.1.3-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,12 +17,12 @@ module PulpFileClient
|
|
17
17
|
# Timestamp of creation.
|
18
18
|
attr_accessor :_created
|
19
19
|
|
20
|
-
attr_accessor :
|
20
|
+
attr_accessor :_type
|
21
21
|
|
22
22
|
# Artifact file representing the physical content
|
23
23
|
attr_accessor :_artifact
|
24
24
|
|
25
|
-
attr_accessor :
|
25
|
+
attr_accessor :_href
|
26
26
|
|
27
27
|
# The MD5 checksum if available.
|
28
28
|
attr_accessor :md5
|
@@ -49,9 +49,9 @@ module PulpFileClient
|
|
49
49
|
def self.attribute_map
|
50
50
|
{
|
51
51
|
:'_created' => :'_created',
|
52
|
-
:'_href' => :'_href',
|
53
|
-
:'_artifact' => :'_artifact',
|
54
52
|
:'_type' => :'_type',
|
53
|
+
:'_artifact' => :'_artifact',
|
54
|
+
:'_href' => :'_href',
|
55
55
|
:'md5' => :'md5',
|
56
56
|
:'sha1' => :'sha1',
|
57
57
|
:'sha224' => :'sha224',
|
@@ -66,9 +66,9 @@ module PulpFileClient
|
|
66
66
|
def self.openapi_types
|
67
67
|
{
|
68
68
|
:'_created' => :'DateTime',
|
69
|
-
:'_href' => :'String',
|
70
|
-
:'_artifact' => :'String',
|
71
69
|
:'_type' => :'String',
|
70
|
+
:'_artifact' => :'String',
|
71
|
+
:'_href' => :'String',
|
72
72
|
:'md5' => :'String',
|
73
73
|
:'sha1' => :'String',
|
74
74
|
:'sha224' => :'String',
|
@@ -98,16 +98,16 @@ module PulpFileClient
|
|
98
98
|
self._created = attributes[:'_created']
|
99
99
|
end
|
100
100
|
|
101
|
-
if attributes.key?(:'
|
102
|
-
self.
|
101
|
+
if attributes.key?(:'_type')
|
102
|
+
self._type = attributes[:'_type']
|
103
103
|
end
|
104
104
|
|
105
105
|
if attributes.key?(:'_artifact')
|
106
106
|
self._artifact = attributes[:'_artifact']
|
107
107
|
end
|
108
108
|
|
109
|
-
if attributes.key?(:'
|
110
|
-
self.
|
109
|
+
if attributes.key?(:'_href')
|
110
|
+
self._href = attributes[:'_href']
|
111
111
|
end
|
112
112
|
|
113
113
|
if attributes.key?(:'md5')
|
@@ -143,14 +143,14 @@ module PulpFileClient
|
|
143
143
|
# @return Array for valid properties with the reasons
|
144
144
|
def list_invalid_properties
|
145
145
|
invalid_properties = Array.new
|
146
|
-
if @_artifact.nil?
|
147
|
-
invalid_properties.push('invalid value for "_artifact", _artifact cannot be nil.')
|
148
|
-
end
|
149
|
-
|
150
146
|
if !@_type.nil? && @_type.to_s.length < 1
|
151
147
|
invalid_properties.push('invalid value for "_type", the character length must be great than or equal to 1.')
|
152
148
|
end
|
153
149
|
|
150
|
+
if @_artifact.nil?
|
151
|
+
invalid_properties.push('invalid value for "_artifact", _artifact cannot be nil.')
|
152
|
+
end
|
153
|
+
|
154
154
|
if !@md5.nil? && @md5.to_s.length < 1
|
155
155
|
invalid_properties.push('invalid value for "md5", the character length must be great than or equal to 1.')
|
156
156
|
end
|
@@ -189,8 +189,8 @@ module PulpFileClient
|
|
189
189
|
# Check to see if the all the properties in the model are valid
|
190
190
|
# @return true if the model is valid
|
191
191
|
def valid?
|
192
|
-
return false if @_artifact.nil?
|
193
192
|
return false if !@_type.nil? && @_type.to_s.length < 1
|
193
|
+
return false if @_artifact.nil?
|
194
194
|
return false if !@md5.nil? && @md5.to_s.length < 1
|
195
195
|
return false if !@sha1.nil? && @sha1.to_s.length < 1
|
196
196
|
return false if !@sha224.nil? && @sha224.to_s.length < 1
|
@@ -292,9 +292,9 @@ module PulpFileClient
|
|
292
292
|
return true if self.equal?(o)
|
293
293
|
self.class == o.class &&
|
294
294
|
_created == o._created &&
|
295
|
-
_href == o._href &&
|
296
|
-
_artifact == o._artifact &&
|
297
295
|
_type == o._type &&
|
296
|
+
_artifact == o._artifact &&
|
297
|
+
_href == o._href &&
|
298
298
|
md5 == o.md5 &&
|
299
299
|
sha1 == o.sha1 &&
|
300
300
|
sha224 == o.sha224 &&
|
@@ -313,7 +313,7 @@ module PulpFileClient
|
|
313
313
|
# Calculates hash code according to all attributes.
|
314
314
|
# @return [Integer] Hash code
|
315
315
|
def hash
|
316
|
-
[_created,
|
316
|
+
[_created, _type, _artifact, _href, md5, sha1, sha224, sha256, sha384, sha512, relative_path].hash
|
317
317
|
end
|
318
318
|
|
319
319
|
# Builds the object from hash
|