pulp_rpm_client 3.0.0b4.dev0.1561996773 → 3.0.0b5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -6
  3. data/docs/Addon.md +27 -0
  4. data/docs/Artifact.md +35 -0
  5. data/docs/Checksum.md +19 -0
  6. data/docs/ContentAdvisoriesApi.md +12 -6
  7. data/docs/ContentPackagesApi.md +12 -6
  8. data/docs/DistributionTree.md +53 -0
  9. data/docs/DistributionTreesDistributionTreesApi.md +179 -0
  10. data/docs/DistributionsRpmApi.md +14 -8
  11. data/docs/Image.md +23 -0
  12. data/docs/InlineResponse200.md +3 -3
  13. data/docs/InlineResponse2001.md +3 -3
  14. data/docs/InlineResponse2002.md +4 -4
  15. data/docs/InlineResponse2003.md +4 -4
  16. data/docs/InlineResponse2004.md +4 -4
  17. data/docs/InlineResponse2005.md +23 -0
  18. data/docs/InlineResponse2006.md +23 -0
  19. data/docs/Package.md +9 -7
  20. data/docs/PublicationsRpmApi.md +14 -8
  21. data/docs/RemotesRpmApi.md +14 -8
  22. data/docs/RepoMetadataFile.md +31 -0
  23. data/docs/RepoMetadataFilesRepoMetadataFilesApi.md +179 -0
  24. data/docs/Variant.md +37 -0
  25. data/git_push.sh +10 -7
  26. data/lib/pulp_rpm_client/api/content_advisories_api.rb +15 -9
  27. data/lib/pulp_rpm_client/api/content_packages_api.rb +15 -9
  28. data/lib/pulp_rpm_client/api/distribution_trees_distribution_trees_api.rb +212 -0
  29. data/lib/pulp_rpm_client/api/distributions_rpm_api.rb +21 -15
  30. data/lib/pulp_rpm_client/api/publications_rpm_api.rb +19 -13
  31. data/lib/pulp_rpm_client/api/remotes_rpm_api.rb +22 -16
  32. data/lib/pulp_rpm_client/api/repo_metadata_files_repo_metadata_files_api.rb +212 -0
  33. data/lib/pulp_rpm_client/api/rpm_copy_api.rb +2 -2
  34. data/lib/pulp_rpm_client/api/rpm_upload_api.rb +2 -2
  35. data/lib/pulp_rpm_client/api_client.rb +77 -62
  36. data/lib/pulp_rpm_client/api_error.rb +1 -1
  37. data/lib/pulp_rpm_client/configuration.rb +13 -21
  38. data/lib/pulp_rpm_client/models/addon.rb +372 -0
  39. data/lib/pulp_rpm_client/models/artifact.rb +376 -0
  40. data/lib/pulp_rpm_client/models/async_operation_response.rb +1 -1
  41. data/lib/pulp_rpm_client/models/checksum.rb +255 -0
  42. data/lib/pulp_rpm_client/models/distribution_tree.rb +660 -0
  43. data/lib/pulp_rpm_client/models/image.rb +303 -0
  44. data/lib/pulp_rpm_client/models/inline_response200.rb +11 -11
  45. data/lib/pulp_rpm_client/models/inline_response2001.rb +11 -11
  46. data/lib/pulp_rpm_client/models/inline_response2002.rb +12 -12
  47. data/lib/pulp_rpm_client/models/inline_response2003.rb +12 -12
  48. data/lib/pulp_rpm_client/models/inline_response2004.rb +12 -12
  49. data/lib/pulp_rpm_client/models/inline_response2005.rb +235 -0
  50. data/lib/pulp_rpm_client/models/inline_response2006.rb +235 -0
  51. data/lib/pulp_rpm_client/models/package.rb +70 -41
  52. data/lib/pulp_rpm_client/models/repo_metadata_file.rb +381 -0
  53. data/lib/pulp_rpm_client/models/repository_sync_url.rb +1 -1
  54. data/lib/pulp_rpm_client/models/rpm_distribution.rb +1 -1
  55. data/lib/pulp_rpm_client/models/rpm_publication.rb +1 -1
  56. data/lib/pulp_rpm_client/models/rpm_remote.rb +1 -1
  57. data/lib/pulp_rpm_client/models/update_record.rb +1 -1
  58. data/lib/pulp_rpm_client/models/variant.rb +542 -0
  59. data/lib/pulp_rpm_client/version.rb +2 -2
  60. data/lib/pulp_rpm_client.rb +12 -1
  61. data/pulp_rpm_client.gemspec +3 -9
  62. data/spec/api/content_advisories_api_spec.rb +5 -3
  63. data/spec/api/content_packages_api_spec.rb +5 -3
  64. data/spec/api/distribution_trees_distribution_trees_api_spec.rb +74 -0
  65. data/spec/api/distributions_rpm_api_spec.rb +6 -4
  66. data/spec/api/publications_rpm_api_spec.rb +6 -4
  67. data/spec/api/remotes_rpm_api_spec.rb +6 -4
  68. data/spec/api/repo_metadata_files_repo_metadata_files_api_spec.rb +74 -0
  69. data/spec/api/rpm_copy_api_spec.rb +1 -1
  70. data/spec/api/rpm_upload_api_spec.rb +1 -1
  71. data/spec/api_client_spec.rb +1 -39
  72. data/spec/configuration_spec.rb +1 -1
  73. data/spec/models/addon_spec.rb +71 -0
  74. data/spec/models/artifact_spec.rb +95 -0
  75. data/spec/models/async_operation_response_spec.rb +1 -1
  76. data/spec/models/checksum_spec.rb +47 -0
  77. data/spec/models/distribution_tree_spec.rb +149 -0
  78. data/spec/models/image_spec.rb +59 -0
  79. data/spec/models/inline_response2001_spec.rb +4 -4
  80. data/spec/models/inline_response2002_spec.rb +4 -4
  81. data/spec/models/inline_response2003_spec.rb +4 -4
  82. data/spec/models/inline_response2004_spec.rb +4 -4
  83. data/spec/models/inline_response2005_spec.rb +59 -0
  84. data/spec/models/inline_response2006_spec.rb +59 -0
  85. data/spec/models/inline_response200_spec.rb +4 -4
  86. data/spec/models/package_spec.rb +16 -10
  87. data/spec/models/repo_metadata_file_spec.rb +83 -0
  88. data/spec/models/repository_sync_url_spec.rb +1 -1
  89. data/spec/models/rpm_distribution_spec.rb +1 -1
  90. data/spec/models/rpm_publication_spec.rb +1 -1
  91. data/spec/models/rpm_remote_spec.rb +1 -1
  92. data/spec/models/update_record_spec.rb +1 -1
  93. data/spec/models/variant_spec.rb +101 -0
  94. data/spec/spec_helper.rb +1 -1
  95. metadata +50 -133
  96. 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.0.0
9
+ OpenAPI Generator version: 4.1.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
13
+ require 'cgi'
14
14
 
15
15
  module PulpRpmClient
16
16
  class RemotesRpmApi
@@ -107,7 +107,7 @@ module PulpRpmClient
107
107
  fail ArgumentError, "Missing the required parameter 'rpm_remote_href' when calling RemotesRpmApi.delete"
108
108
  end
109
109
  # resource path
110
- local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', rpm_remote_href.to_s)
110
+ local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', CGI.escape(rpm_remote_href.to_s).gsub('%2F', '/'))
111
111
 
112
112
  # query parameters
113
113
  query_params = opts[:query_params] || {}
@@ -156,9 +156,10 @@ module PulpRpmClient
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] :page A page number within the paginated result set.
160
- # @option opts [Integer] :page_size Number of results to return per page.
161
- # @return [InlineResponse2004]
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.
162
+ # @return [InlineResponse2005]
162
163
  def list(opts = {})
163
164
  data, _status_code, _headers = list_with_http_info(opts)
164
165
  data
@@ -175,9 +176,10 @@ module PulpRpmClient
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] :page A page number within the paginated result set.
179
- # @option opts [Integer] :page_size Number of results to return per page.
180
- # @return [Array<(InlineResponse2004, Integer, Hash)>] InlineResponse2004 data, response status code and response headers
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.
182
+ # @return [Array<(InlineResponse2005, Integer, Hash)>] InlineResponse2005 data, response status code and response headers
181
183
  def list_with_http_info(opts = {})
182
184
  if @api_client.config.debugging
183
185
  @api_client.config.logger.debug 'Calling API: RemotesRpmApi.list ...'
@@ -195,8 +197,9 @@ module PulpRpmClient
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[:'page'] = opts[:'page'] if !opts[:'page'].nil?
199
- query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
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] || {}
@@ -210,7 +213,7 @@ module PulpRpmClient
210
213
  post_body = opts[:body]
211
214
 
212
215
  # return_type
213
- return_type = opts[:return_type] || 'InlineResponse2004'
216
+ return_type = opts[:return_type] || 'InlineResponse2005'
214
217
 
215
218
  # auth_names
216
219
  auth_names = opts[:auth_names] || ['Basic']
@@ -261,7 +264,7 @@ module PulpRpmClient
261
264
  fail ArgumentError, "Missing the required parameter 'data' when calling RemotesRpmApi.partial_update"
262
265
  end
263
266
  # resource path
264
- local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', rpm_remote_href.to_s)
267
+ local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', CGI.escape(rpm_remote_href.to_s).gsub('%2F', '/'))
265
268
 
266
269
  # query parameters
267
270
  query_params = opts[:query_params] || {}
@@ -305,6 +308,7 @@ module PulpRpmClient
305
308
  # A ViewSet for RpmRemote.
306
309
  # @param rpm_remote_href [String] URI of Rpm Remote. e.g.: /pulp/api/v3/remotes/rpm/rpm/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 [RpmRemote]
309
313
  def read(rpm_remote_href, opts = {})
310
314
  data, _status_code, _headers = read_with_http_info(rpm_remote_href, opts)
@@ -315,6 +319,7 @@ module PulpRpmClient
315
319
  # A ViewSet for RpmRemote.
316
320
  # @param rpm_remote_href [String] URI of Rpm Remote. e.g.: /pulp/api/v3/remotes/rpm/rpm/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<(RpmRemote, Integer, Hash)>] RpmRemote data, response status code and response headers
319
324
  def read_with_http_info(rpm_remote_href, opts = {})
320
325
  if @api_client.config.debugging
@@ -325,10 +330,11 @@ module PulpRpmClient
325
330
  fail ArgumentError, "Missing the required parameter 'rpm_remote_href' when calling RemotesRpmApi.read"
326
331
  end
327
332
  # resource path
328
- local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', rpm_remote_href.to_s)
333
+ local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', CGI.escape(rpm_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] || {}
@@ -393,7 +399,7 @@ module PulpRpmClient
393
399
  fail ArgumentError, "Missing the required parameter 'data' when calling RemotesRpmApi.sync"
394
400
  end
395
401
  # resource path
396
- local_var_path = '{rpm_remote_href}sync/'.sub('{' + 'rpm_remote_href' + '}', rpm_remote_href.to_s)
402
+ local_var_path = '{rpm_remote_href}sync/'.sub('{' + 'rpm_remote_href' + '}', CGI.escape(rpm_remote_href.to_s).gsub('%2F', '/'))
397
403
 
398
404
  # query parameters
399
405
  query_params = opts[:query_params] || {}
@@ -463,7 +469,7 @@ module PulpRpmClient
463
469
  fail ArgumentError, "Missing the required parameter 'data' when calling RemotesRpmApi.update"
464
470
  end
465
471
  # resource path
466
- local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', rpm_remote_href.to_s)
472
+ local_var_path = '{rpm_remote_href}'.sub('{' + 'rpm_remote_href' + '}', CGI.escape(rpm_remote_href.to_s).gsub('%2F', '/'))
467
473
 
468
474
  # query parameters
469
475
  query_params = opts[:query_params] || {}
@@ -0,0 +1,212 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.1.3-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module PulpRpmClient
16
+ class RepoMetadataFilesRepoMetadataFilesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Delete a repo metadata file
23
+ # RepoMetadataFile Viewset.
24
+ # @param repo_metadata_file_href [String] URI of Repo Metadata File. e.g.: /pulp/api/v3/repo_metadata_files/rpm/repo_metadata_files/1/
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [nil]
27
+ def delete(repo_metadata_file_href, opts = {})
28
+ delete_with_http_info(repo_metadata_file_href, opts)
29
+ nil
30
+ end
31
+
32
+ # Delete a repo metadata file
33
+ # RepoMetadataFile Viewset.
34
+ # @param repo_metadata_file_href [String] URI of Repo Metadata File. e.g.: /pulp/api/v3/repo_metadata_files/rpm/repo_metadata_files/1/
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
37
+ def delete_with_http_info(repo_metadata_file_href, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: RepoMetadataFilesRepoMetadataFilesApi.delete ...'
40
+ end
41
+ # verify the required parameter 'repo_metadata_file_href' is set
42
+ if @api_client.config.client_side_validation && repo_metadata_file_href.nil?
43
+ fail ArgumentError, "Missing the required parameter 'repo_metadata_file_href' when calling RepoMetadataFilesRepoMetadataFilesApi.delete"
44
+ end
45
+ # resource path
46
+ local_var_path = '{repo_metadata_file_href}'.sub('{' + 'repo_metadata_file_href' + '}', CGI.escape(repo_metadata_file_href.to_s).gsub('%2F', '/'))
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:body]
59
+
60
+ # return_type
61
+ return_type = opts[:return_type]
62
+
63
+ # auth_names
64
+ auth_names = opts[:auth_names] || ['Basic']
65
+
66
+ new_options = opts.merge(
67
+ :header_params => header_params,
68
+ :query_params => query_params,
69
+ :form_params => form_params,
70
+ :body => post_body,
71
+ :auth_names => auth_names,
72
+ :return_type => return_type
73
+ )
74
+
75
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
76
+ if @api_client.config.debugging
77
+ @api_client.config.logger.debug "API called: RepoMetadataFilesRepoMetadataFilesApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
78
+ end
79
+ return data, status_code, headers
80
+ end
81
+
82
+ # List repo metadata files
83
+ # RepoMetadataFile Viewset.
84
+ # @param [Hash] opts the optional parameters
85
+ # @option opts [Integer] :limit Number of results to return per page.
86
+ # @option opts [Integer] :offset The initial index from which to return the results.
87
+ # @option opts [String] :fields A list of fields to include in the response.
88
+ # @return [InlineResponse2006]
89
+ def list(opts = {})
90
+ data, _status_code, _headers = list_with_http_info(opts)
91
+ data
92
+ end
93
+
94
+ # List repo metadata files
95
+ # RepoMetadataFile Viewset.
96
+ # @param [Hash] opts the optional parameters
97
+ # @option opts [Integer] :limit Number of results to return per page.
98
+ # @option opts [Integer] :offset The initial index from which to return the results.
99
+ # @option opts [String] :fields A list of fields to include in the response.
100
+ # @return [Array<(InlineResponse2006, Integer, Hash)>] InlineResponse2006 data, response status code and response headers
101
+ def list_with_http_info(opts = {})
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug 'Calling API: RepoMetadataFilesRepoMetadataFilesApi.list ...'
104
+ end
105
+ # resource path
106
+ local_var_path = '/pulp/api/v3/repo_metadata_files/rpm/repo_metadata_files/'
107
+
108
+ # query parameters
109
+ query_params = opts[:query_params] || {}
110
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
111
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
112
+ query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
113
+
114
+ # header parameters
115
+ header_params = opts[:header_params] || {}
116
+ # HTTP header 'Accept' (if needed)
117
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
118
+
119
+ # form parameters
120
+ form_params = opts[:form_params] || {}
121
+
122
+ # http body (model)
123
+ post_body = opts[:body]
124
+
125
+ # return_type
126
+ return_type = opts[:return_type] || 'InlineResponse2006'
127
+
128
+ # auth_names
129
+ auth_names = opts[:auth_names] || ['Basic']
130
+
131
+ new_options = opts.merge(
132
+ :header_params => header_params,
133
+ :query_params => query_params,
134
+ :form_params => form_params,
135
+ :body => post_body,
136
+ :auth_names => auth_names,
137
+ :return_type => return_type
138
+ )
139
+
140
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
141
+ if @api_client.config.debugging
142
+ @api_client.config.logger.debug "API called: RepoMetadataFilesRepoMetadataFilesApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
143
+ end
144
+ return data, status_code, headers
145
+ end
146
+
147
+ # Inspect a repo metadata file
148
+ # RepoMetadataFile Viewset.
149
+ # @param repo_metadata_file_href [String] URI of Repo Metadata File. e.g.: /pulp/api/v3/repo_metadata_files/rpm/repo_metadata_files/1/
150
+ # @param [Hash] opts the optional parameters
151
+ # @option opts [String] :fields A list of fields to include in the response.
152
+ # @return [RepoMetadataFile]
153
+ def read(repo_metadata_file_href, opts = {})
154
+ data, _status_code, _headers = read_with_http_info(repo_metadata_file_href, opts)
155
+ data
156
+ end
157
+
158
+ # Inspect a repo metadata file
159
+ # RepoMetadataFile Viewset.
160
+ # @param repo_metadata_file_href [String] URI of Repo Metadata File. e.g.: /pulp/api/v3/repo_metadata_files/rpm/repo_metadata_files/1/
161
+ # @param [Hash] opts the optional parameters
162
+ # @option opts [String] :fields A list of fields to include in the response.
163
+ # @return [Array<(RepoMetadataFile, Integer, Hash)>] RepoMetadataFile data, response status code and response headers
164
+ def read_with_http_info(repo_metadata_file_href, opts = {})
165
+ if @api_client.config.debugging
166
+ @api_client.config.logger.debug 'Calling API: RepoMetadataFilesRepoMetadataFilesApi.read ...'
167
+ end
168
+ # verify the required parameter 'repo_metadata_file_href' is set
169
+ if @api_client.config.client_side_validation && repo_metadata_file_href.nil?
170
+ fail ArgumentError, "Missing the required parameter 'repo_metadata_file_href' when calling RepoMetadataFilesRepoMetadataFilesApi.read"
171
+ end
172
+ # resource path
173
+ local_var_path = '{repo_metadata_file_href}'.sub('{' + 'repo_metadata_file_href' + '}', CGI.escape(repo_metadata_file_href.to_s).gsub('%2F', '/'))
174
+
175
+ # query parameters
176
+ query_params = opts[:query_params] || {}
177
+ query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
178
+
179
+ # header parameters
180
+ header_params = opts[:header_params] || {}
181
+ # HTTP header 'Accept' (if needed)
182
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
183
+
184
+ # form parameters
185
+ form_params = opts[:form_params] || {}
186
+
187
+ # http body (model)
188
+ post_body = opts[:body]
189
+
190
+ # return_type
191
+ return_type = opts[:return_type] || 'RepoMetadataFile'
192
+
193
+ # auth_names
194
+ auth_names = opts[:auth_names] || ['Basic']
195
+
196
+ new_options = opts.merge(
197
+ :header_params => header_params,
198
+ :query_params => query_params,
199
+ :form_params => form_params,
200
+ :body => post_body,
201
+ :auth_names => auth_names,
202
+ :return_type => return_type
203
+ )
204
+
205
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
206
+ if @api_client.config.debugging
207
+ @api_client.config.logger.debug "API called: RepoMetadataFilesRepoMetadataFilesApi#read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
208
+ end
209
+ return data, status_code, headers
210
+ end
211
+ end
212
+ end
@@ -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.0.0
9
+ OpenAPI Generator version: 4.1.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
13
+ require 'cgi'
14
14
 
15
15
  module PulpRpmClient
16
16
  class RpmCopyApi
@@ -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.0.0
9
+ OpenAPI Generator version: 4.1.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
13
+ require 'cgi'
14
14
 
15
15
  module PulpRpmClient
16
16
  class RpmUploadApi
@@ -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.0.0
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 'typhoeus'
18
- require 'uri'
17
+ require 'faraday'
19
18
 
20
19
  module PulpRpmClient
21
20
  class ApiClient
@@ -47,26 +46,46 @@ module PulpRpmClient
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
- request = build_request(http_method, path, opts)
51
- response = request.run
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
- if @config.debugging
54
- @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
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
- unless response.success?
58
- if response.timed_out?
59
- fail ApiError.new('Connection timed out')
60
- elsif response.code == 0
61
- # Errors from libcurl will be made visible here
62
- fail ApiError.new(:code => 0,
63
- :message => response.return_message)
64
- else
65
- fail ApiError.new(:code => response.code,
66
- :response_headers => response.headers,
67
- :response_body => response.body),
68
- response.status_message
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 PulpRpmClient
74
93
  else
75
94
  data = nil
76
95
  end
77
- return data, response.code, response.headers
96
+ return data, response.status, response.headers
78
97
  end
79
98
 
80
99
  # Builds the HTTP request
@@ -86,7 +105,7 @@ module PulpRpmClient
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 PulpRpmClient
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 PulpRpmClient
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 = Typhoeus::Request.new(url, req_opts)
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 PulpRpmClient
262
305
  def build_request_url(path)
263
306
  # Add leading and trailing slashes to path
264
307
  path = "/#{path}".gsub(/\/+/, '/')
265
- URI.encode(@config.base_url + path)
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,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.0.0
9
+ OpenAPI Generator version: 4.1.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -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.0.0
9
+ OpenAPI Generator version: 4.1.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
14
-
15
13
  module PulpRpmClient
16
14
  class Configuration
17
15
  # Defines url scheme
@@ -88,33 +86,28 @@ module PulpRpmClient
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 :verify_ssl
89
+ attr_accessor :ssl_verify
92
90
 
93
91
  ### TLS/SSL setting
94
- # Set this to false to skip verifying SSL host name
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
- # @return [true, false]
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 :cert_file
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 :key_file
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 PulpRpmClient
135
128
  @api_key_prefix = {}
136
129
  @timeout = 0
137
130
  @client_side_validation = true
138
- @verify_ssl = true
139
- @verify_ssl_host = true
140
- @params_encoding = nil
141
- @cert_file = nil
142
- @key_file = nil
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 PulpRpmClient
174
167
  end
175
168
 
176
169
  def base_url
177
- url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
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).