harbor2_client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +186 -0
  4. data/Rakefile +8 -0
  5. data/docs/AdditionLink.md +9 -0
  6. data/docs/AdditionLinks.md +7 -0
  7. data/docs/Annotations.md +7 -0
  8. data/docs/Artifact.md +25 -0
  9. data/docs/ArtifactApi.md +694 -0
  10. data/docs/AuditLog.md +13 -0
  11. data/docs/AuditlogApi.md +69 -0
  12. data/docs/CVEAllowlist.md +13 -0
  13. data/docs/CVEAllowlistItem.md +8 -0
  14. data/docs/Error.md +9 -0
  15. data/docs/Errors.md +8 -0
  16. data/docs/Execution.md +17 -0
  17. data/docs/ExtraAttrs.md +7 -0
  18. data/docs/Icon.md +9 -0
  19. data/docs/IconApi.md +66 -0
  20. data/docs/Instance.md +19 -0
  21. data/docs/Label.md +15 -0
  22. data/docs/Metadata.md +13 -0
  23. data/docs/Metrics.md +14 -0
  24. data/docs/NativeReportSummary.md +15 -0
  25. data/docs/Platform.md +12 -0
  26. data/docs/PreheatApi.md +1176 -0
  27. data/docs/PreheatPolicy.md +18 -0
  28. data/docs/Project.md +22 -0
  29. data/docs/ProjectApi.md +542 -0
  30. data/docs/ProjectDeletable.md +9 -0
  31. data/docs/ProjectMetadata.md +14 -0
  32. data/docs/ProjectReq.md +13 -0
  33. data/docs/ProjectSummary.md +16 -0
  34. data/docs/ProjectSummaryQuota.md +9 -0
  35. data/docs/ProviderUnderProject.md +11 -0
  36. data/docs/Reference.md +13 -0
  37. data/docs/Registry.md +17 -0
  38. data/docs/RegistryCredential.md +10 -0
  39. data/docs/Repository.md +15 -0
  40. data/docs/RepositoryApi.md +256 -0
  41. data/docs/ResourceList.md +7 -0
  42. data/docs/ScanApi.md +138 -0
  43. data/docs/ScanOverview.md +7 -0
  44. data/docs/Tag.md +15 -0
  45. data/docs/Task.md +17 -0
  46. data/docs/VulnerabilitySummary.md +10 -0
  47. data/git_push.sh +55 -0
  48. data/harbor2_client.gemspec +46 -0
  49. data/lib/harbor2_client.rb +81 -0
  50. data/lib/harbor2_client/api/artifact_api.rb +848 -0
  51. data/lib/harbor2_client/api/auditlog_api.rb +91 -0
  52. data/lib/harbor2_client/api/icon_api.rb +84 -0
  53. data/lib/harbor2_client/api/preheat_api.rb +1327 -0
  54. data/lib/harbor2_client/api/project_api.rb +601 -0
  55. data/lib/harbor2_client/api/repository_api.rb +302 -0
  56. data/lib/harbor2_client/api/scan_api.rb +174 -0
  57. data/lib/harbor2_client/api_client.rb +391 -0
  58. data/lib/harbor2_client/api_error.rb +38 -0
  59. data/lib/harbor2_client/configuration.rb +209 -0
  60. data/lib/harbor2_client/models/addition_link.rb +195 -0
  61. data/lib/harbor2_client/models/addition_links.rb +175 -0
  62. data/lib/harbor2_client/models/annotations.rb +175 -0
  63. data/lib/harbor2_client/models/artifact.rb +355 -0
  64. data/lib/harbor2_client/models/audit_log.rb +235 -0
  65. data/lib/harbor2_client/models/cve_allowlist.rb +237 -0
  66. data/lib/harbor2_client/models/cve_allowlist_item.rb +186 -0
  67. data/lib/harbor2_client/models/error.rb +196 -0
  68. data/lib/harbor2_client/models/errors.rb +187 -0
  69. data/lib/harbor2_client/models/execution.rb +273 -0
  70. data/lib/harbor2_client/models/extra_attrs.rb +175 -0
  71. data/lib/harbor2_client/models/icon.rb +195 -0
  72. data/lib/harbor2_client/models/instance.rb +297 -0
  73. data/lib/harbor2_client/models/label.rb +255 -0
  74. data/lib/harbor2_client/models/metadata.rb +237 -0
  75. data/lib/harbor2_client/models/metrics.rb +245 -0
  76. data/lib/harbor2_client/models/native_report_summary.rb +255 -0
  77. data/lib/harbor2_client/models/platform.rb +227 -0
  78. data/lib/harbor2_client/models/preheat_policy.rb +285 -0
  79. data/lib/harbor2_client/models/project.rb +327 -0
  80. data/lib/harbor2_client/models/project_deletable.rb +195 -0
  81. data/lib/harbor2_client/models/project_metadata.rb +245 -0
  82. data/lib/harbor2_client/models/project_req.rb +235 -0
  83. data/lib/harbor2_client/models/project_summary.rb +263 -0
  84. data/lib/harbor2_client/models/project_summary_quota.rb +195 -0
  85. data/lib/harbor2_client/models/provider_under_project.rb +211 -0
  86. data/lib/harbor2_client/models/reference.rb +235 -0
  87. data/lib/harbor2_client/models/registry.rb +274 -0
  88. data/lib/harbor2_client/models/registry_credential.rb +205 -0
  89. data/lib/harbor2_client/models/repository.rb +255 -0
  90. data/lib/harbor2_client/models/resource_list.rb +175 -0
  91. data/lib/harbor2_client/models/scan_overview.rb +176 -0
  92. data/lib/harbor2_client/models/tag.rb +255 -0
  93. data/lib/harbor2_client/models/task.rb +274 -0
  94. data/lib/harbor2_client/models/vulnerability_summary.rb +208 -0
  95. data/lib/harbor2_client/version.rb +15 -0
  96. data/spec/api/artifact_api_spec.rb +209 -0
  97. data/spec/api/auditlog_api_spec.rb +50 -0
  98. data/spec/api/icon_api_spec.rb +48 -0
  99. data/spec/api/preheat_api_spec.rb +311 -0
  100. data/spec/api/project_api_spec.rb +160 -0
  101. data/spec/api/repository_api_spec.rb +94 -0
  102. data/spec/api/scan_api_spec.rb +66 -0
  103. data/spec/api_client_spec.rb +243 -0
  104. data/spec/configuration_spec.rb +42 -0
  105. data/spec/models/addition_link_spec.rb +47 -0
  106. data/spec/models/addition_links_spec.rb +35 -0
  107. data/spec/models/annotations_spec.rb +35 -0
  108. data/spec/models/artifact_spec.rb +143 -0
  109. data/spec/models/audit_log_spec.rb +71 -0
  110. data/spec/models/cve_allowlist_item_spec.rb +41 -0
  111. data/spec/models/cve_allowlist_spec.rb +71 -0
  112. data/spec/models/error_spec.rb +47 -0
  113. data/spec/models/errors_spec.rb +41 -0
  114. data/spec/models/execution_spec.rb +95 -0
  115. data/spec/models/extra_attrs_spec.rb +35 -0
  116. data/spec/models/icon_spec.rb +47 -0
  117. data/spec/models/instance_spec.rb +107 -0
  118. data/spec/models/label_spec.rb +83 -0
  119. data/spec/models/metadata_spec.rb +71 -0
  120. data/spec/models/metrics_spec.rb +77 -0
  121. data/spec/models/native_report_summary_spec.rb +83 -0
  122. data/spec/models/platform_spec.rb +65 -0
  123. data/spec/models/preheat_policy_spec.rb +101 -0
  124. data/spec/models/project_deletable_spec.rb +47 -0
  125. data/spec/models/project_metadata_spec.rb +77 -0
  126. data/spec/models/project_req_spec.rb +71 -0
  127. data/spec/models/project_spec.rb +125 -0
  128. data/spec/models/project_summary_quota_spec.rb +47 -0
  129. data/spec/models/project_summary_spec.rb +89 -0
  130. data/spec/models/provider_under_project_spec.rb +59 -0
  131. data/spec/models/reference_spec.rb +71 -0
  132. data/spec/models/registry_credential_spec.rb +53 -0
  133. data/spec/models/registry_spec.rb +95 -0
  134. data/spec/models/repository_spec.rb +83 -0
  135. data/spec/models/resource_list_spec.rb +35 -0
  136. data/spec/models/scan_overview_spec.rb +35 -0
  137. data/spec/models/tag_spec.rb +83 -0
  138. data/spec/models/task_spec.rb +95 -0
  139. data/spec/models/vulnerability_summary_spec.rb +53 -0
  140. data/spec/spec_helper.rb +111 -0
  141. metadata +428 -0
@@ -0,0 +1,302 @@
1
+ =begin
2
+ #Harbor API
3
+
4
+ #These APIs provide services for manipulating Harbor project.
5
+
6
+ OpenAPI spec version: 2.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.17
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Harbor2Client
16
+ class RepositoryApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Delete repository
23
+ # Delete the repository specified by name
24
+ # @param project_name The name of the project
25
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [String] :x_request_id An unique ID for the request
28
+ # @return [nil]
29
+ def delete_repository(project_name, repository_name, opts = {})
30
+ delete_repository_with_http_info(project_name, repository_name, opts)
31
+ nil
32
+ end
33
+
34
+ # Delete repository
35
+ # Delete the repository specified by name
36
+ # @param project_name The name of the project
37
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -> a%252Fb
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [String] :x_request_id An unique ID for the request
40
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
41
+ def delete_repository_with_http_info(project_name, repository_name, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: RepositoryApi.delete_repository ...'
44
+ end
45
+ # verify the required parameter 'project_name' is set
46
+ if @api_client.config.client_side_validation && project_name.nil?
47
+ fail ArgumentError, "Missing the required parameter 'project_name' when calling RepositoryApi.delete_repository"
48
+ end
49
+ # verify the required parameter 'repository_name' is set
50
+ if @api_client.config.client_side_validation && repository_name.nil?
51
+ fail ArgumentError, "Missing the required parameter 'repository_name' when calling RepositoryApi.delete_repository"
52
+ end
53
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
54
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RepositoryApi.delete_repository, the character length must be great than or equal to 1.'
55
+ end
56
+
57
+ # resource path
58
+ local_var_path = '/projects/{project_name}/repositories/{repository_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s)
59
+
60
+ # query parameters
61
+ query_params = {}
62
+
63
+ # header parameters
64
+ header_params = {}
65
+ # HTTP header 'Accept' (if needed)
66
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
67
+ # HTTP header 'Content-Type'
68
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
69
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
70
+
71
+ # form parameters
72
+ form_params = {}
73
+
74
+ # http body (model)
75
+ post_body = nil
76
+ auth_names = ['basic']
77
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
78
+ :header_params => header_params,
79
+ :query_params => query_params,
80
+ :form_params => form_params,
81
+ :body => post_body,
82
+ :auth_names => auth_names)
83
+ if @api_client.config.debugging
84
+ @api_client.config.logger.debug "API called: RepositoryApi#delete_repository\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
85
+ end
86
+ return data, status_code, headers
87
+ end
88
+ # Get repository
89
+ # Get the repository specified by name
90
+ # @param project_name The name of the project
91
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb
92
+ # @param [Hash] opts the optional parameters
93
+ # @option opts [String] :x_request_id An unique ID for the request
94
+ # @return [Repository]
95
+ def get_repository(project_name, repository_name, opts = {})
96
+ data, _status_code, _headers = get_repository_with_http_info(project_name, repository_name, opts)
97
+ data
98
+ end
99
+
100
+ # Get repository
101
+ # Get the repository specified by name
102
+ # @param project_name The name of the project
103
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb
104
+ # @param [Hash] opts the optional parameters
105
+ # @option opts [String] :x_request_id An unique ID for the request
106
+ # @return [Array<(Repository, Fixnum, Hash)>] Repository data, response status code and response headers
107
+ def get_repository_with_http_info(project_name, repository_name, opts = {})
108
+ if @api_client.config.debugging
109
+ @api_client.config.logger.debug 'Calling API: RepositoryApi.get_repository ...'
110
+ end
111
+ # verify the required parameter 'project_name' is set
112
+ if @api_client.config.client_side_validation && project_name.nil?
113
+ fail ArgumentError, "Missing the required parameter 'project_name' when calling RepositoryApi.get_repository"
114
+ end
115
+ # verify the required parameter 'repository_name' is set
116
+ if @api_client.config.client_side_validation && repository_name.nil?
117
+ fail ArgumentError, "Missing the required parameter 'repository_name' when calling RepositoryApi.get_repository"
118
+ end
119
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
120
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RepositoryApi.get_repository, the character length must be great than or equal to 1.'
121
+ end
122
+
123
+ # resource path
124
+ local_var_path = '/projects/{project_name}/repositories/{repository_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s)
125
+
126
+ # query parameters
127
+ query_params = {}
128
+
129
+ # header parameters
130
+ header_params = {}
131
+ # HTTP header 'Accept' (if needed)
132
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
133
+ # HTTP header 'Content-Type'
134
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
135
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
136
+
137
+ # form parameters
138
+ form_params = {}
139
+
140
+ # http body (model)
141
+ post_body = nil
142
+ auth_names = ['basic']
143
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
144
+ :header_params => header_params,
145
+ :query_params => query_params,
146
+ :form_params => form_params,
147
+ :body => post_body,
148
+ :auth_names => auth_names,
149
+ :return_type => 'Repository')
150
+ if @api_client.config.debugging
151
+ @api_client.config.logger.debug "API called: RepositoryApi#get_repository\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
152
+ end
153
+ return data, status_code, headers
154
+ end
155
+ # List repositories
156
+ # List repositories of the specified project
157
+ # @param project_name The name of the project
158
+ # @param [Hash] opts the optional parameters
159
+ # @option opts [String] :x_request_id An unique ID for the request
160
+ # @option opts [String] :q Query string to query resources. Supported query patterns are \&quot;exact match(k&#x3D;v)\&quot;, \&quot;fuzzy match(k&#x3D;~v)\&quot;, \&quot;range(k&#x3D;[min~max])\&quot;, \&quot;list with union releationship(k&#x3D;{v1 v2 v3})\&quot; and \&quot;list with intersetion relationship(k&#x3D;(v1 v2 v3))\&quot;. The value of range and list can be string(enclosed by \&quot; or &#39;), integer or time(in format \&quot;2020-04-09 02:36:00\&quot;). All of these query patterns should be put in the query string \&quot;q&#x3D;xxx\&quot; and splitted by \&quot;,\&quot;. e.g. q&#x3D;k1&#x3D;v1,k2&#x3D;~v2,k3&#x3D;[min~max]
161
+ # @option opts [Integer] :page The page number (default to 1)
162
+ # @option opts [Integer] :page_size The size of per page (default to 10)
163
+ # @return [Array<Repository>]
164
+ def list_repositories(project_name, opts = {})
165
+ data, _status_code, _headers = list_repositories_with_http_info(project_name, opts)
166
+ data
167
+ end
168
+
169
+ # List repositories
170
+ # List repositories of the specified project
171
+ # @param project_name The name of the project
172
+ # @param [Hash] opts the optional parameters
173
+ # @option opts [String] :x_request_id An unique ID for the request
174
+ # @option opts [String] :q Query string to query resources. Supported query patterns are \&quot;exact match(k&#x3D;v)\&quot;, \&quot;fuzzy match(k&#x3D;~v)\&quot;, \&quot;range(k&#x3D;[min~max])\&quot;, \&quot;list with union releationship(k&#x3D;{v1 v2 v3})\&quot; and \&quot;list with intersetion relationship(k&#x3D;(v1 v2 v3))\&quot;. The value of range and list can be string(enclosed by \&quot; or &#39;), integer or time(in format \&quot;2020-04-09 02:36:00\&quot;). All of these query patterns should be put in the query string \&quot;q&#x3D;xxx\&quot; and splitted by \&quot;,\&quot;. e.g. q&#x3D;k1&#x3D;v1,k2&#x3D;~v2,k3&#x3D;[min~max]
175
+ # @option opts [Integer] :page The page number
176
+ # @option opts [Integer] :page_size The size of per page
177
+ # @return [Array<(Array<Repository>, Fixnum, Hash)>] Array<Repository> data, response status code and response headers
178
+ def list_repositories_with_http_info(project_name, opts = {})
179
+ if @api_client.config.debugging
180
+ @api_client.config.logger.debug 'Calling API: RepositoryApi.list_repositories ...'
181
+ end
182
+ # verify the required parameter 'project_name' is set
183
+ if @api_client.config.client_side_validation && project_name.nil?
184
+ fail ArgumentError, "Missing the required parameter 'project_name' when calling RepositoryApi.list_repositories"
185
+ end
186
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
187
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RepositoryApi.list_repositories, the character length must be great than or equal to 1.'
188
+ end
189
+
190
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
191
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling RepositoryApi.list_repositories, must be smaller than or equal to 100.'
192
+ end
193
+
194
+ # resource path
195
+ local_var_path = '/projects/{project_name}/repositories'.sub('{' + 'project_name' + '}', project_name.to_s)
196
+
197
+ # query parameters
198
+ query_params = {}
199
+ query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
200
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
201
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
202
+
203
+ # header parameters
204
+ header_params = {}
205
+ # HTTP header 'Accept' (if needed)
206
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
207
+ # HTTP header 'Content-Type'
208
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
209
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
210
+
211
+ # form parameters
212
+ form_params = {}
213
+
214
+ # http body (model)
215
+ post_body = nil
216
+ auth_names = ['basic']
217
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
218
+ :header_params => header_params,
219
+ :query_params => query_params,
220
+ :form_params => form_params,
221
+ :body => post_body,
222
+ :auth_names => auth_names,
223
+ :return_type => 'Array<Repository>')
224
+ if @api_client.config.debugging
225
+ @api_client.config.logger.debug "API called: RepositoryApi#list_repositories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
226
+ end
227
+ return data, status_code, headers
228
+ end
229
+ # Update repository
230
+ # Update the repository specified by name
231
+ # @param project_name The name of the project
232
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb
233
+ # @param repository The JSON object of repository.
234
+ # @param [Hash] opts the optional parameters
235
+ # @option opts [String] :x_request_id An unique ID for the request
236
+ # @return [nil]
237
+ def update_repository(project_name, repository_name, repository, opts = {})
238
+ update_repository_with_http_info(project_name, repository_name, repository, opts)
239
+ nil
240
+ end
241
+
242
+ # Update repository
243
+ # Update the repository specified by name
244
+ # @param project_name The name of the project
245
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb
246
+ # @param repository The JSON object of repository.
247
+ # @param [Hash] opts the optional parameters
248
+ # @option opts [String] :x_request_id An unique ID for the request
249
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
250
+ def update_repository_with_http_info(project_name, repository_name, repository, opts = {})
251
+ if @api_client.config.debugging
252
+ @api_client.config.logger.debug 'Calling API: RepositoryApi.update_repository ...'
253
+ end
254
+ # verify the required parameter 'project_name' is set
255
+ if @api_client.config.client_side_validation && project_name.nil?
256
+ fail ArgumentError, "Missing the required parameter 'project_name' when calling RepositoryApi.update_repository"
257
+ end
258
+ # verify the required parameter 'repository_name' is set
259
+ if @api_client.config.client_side_validation && repository_name.nil?
260
+ fail ArgumentError, "Missing the required parameter 'repository_name' when calling RepositoryApi.update_repository"
261
+ end
262
+ # verify the required parameter 'repository' is set
263
+ if @api_client.config.client_side_validation && repository.nil?
264
+ fail ArgumentError, "Missing the required parameter 'repository' when calling RepositoryApi.update_repository"
265
+ end
266
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
267
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RepositoryApi.update_repository, the character length must be great than or equal to 1.'
268
+ end
269
+
270
+ # resource path
271
+ local_var_path = '/projects/{project_name}/repositories/{repository_name}'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s)
272
+
273
+ # query parameters
274
+ query_params = {}
275
+
276
+ # header parameters
277
+ header_params = {}
278
+ # HTTP header 'Accept' (if needed)
279
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
280
+ # HTTP header 'Content-Type'
281
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
282
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
283
+
284
+ # form parameters
285
+ form_params = {}
286
+
287
+ # http body (model)
288
+ post_body = @api_client.object_to_http_body(repository)
289
+ auth_names = ['basic']
290
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
291
+ :header_params => header_params,
292
+ :query_params => query_params,
293
+ :form_params => form_params,
294
+ :body => post_body,
295
+ :auth_names => auth_names)
296
+ if @api_client.config.debugging
297
+ @api_client.config.logger.debug "API called: RepositoryApi#update_repository\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
298
+ end
299
+ return data, status_code, headers
300
+ end
301
+ end
302
+ end
@@ -0,0 +1,174 @@
1
+ =begin
2
+ #Harbor API
3
+
4
+ #These APIs provide services for manipulating Harbor project.
5
+
6
+ OpenAPI spec version: 2.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.17
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Harbor2Client
16
+ class ScanApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get the log of the scan report
23
+ # Get the log of the scan report
24
+ # @param project_name The name of the project
25
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb
26
+ # @param reference The reference of the artifact, can be digest or tag
27
+ # @param report_id The report id to get the log
28
+ # @param [Hash] opts the optional parameters
29
+ # @option opts [String] :x_request_id An unique ID for the request
30
+ # @return [String]
31
+ def get_report_log(project_name, repository_name, reference, report_id, opts = {})
32
+ data, _status_code, _headers = get_report_log_with_http_info(project_name, repository_name, reference, report_id, opts)
33
+ data
34
+ end
35
+
36
+ # Get the log of the scan report
37
+ # Get the log of the scan report
38
+ # @param project_name The name of the project
39
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb
40
+ # @param reference The reference of the artifact, can be digest or tag
41
+ # @param report_id The report id to get the log
42
+ # @param [Hash] opts the optional parameters
43
+ # @option opts [String] :x_request_id An unique ID for the request
44
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
45
+ def get_report_log_with_http_info(project_name, repository_name, reference, report_id, opts = {})
46
+ if @api_client.config.debugging
47
+ @api_client.config.logger.debug 'Calling API: ScanApi.get_report_log ...'
48
+ end
49
+ # verify the required parameter 'project_name' is set
50
+ if @api_client.config.client_side_validation && project_name.nil?
51
+ fail ArgumentError, "Missing the required parameter 'project_name' when calling ScanApi.get_report_log"
52
+ end
53
+ # verify the required parameter 'repository_name' is set
54
+ if @api_client.config.client_side_validation && repository_name.nil?
55
+ fail ArgumentError, "Missing the required parameter 'repository_name' when calling ScanApi.get_report_log"
56
+ end
57
+ # verify the required parameter 'reference' is set
58
+ if @api_client.config.client_side_validation && reference.nil?
59
+ fail ArgumentError, "Missing the required parameter 'reference' when calling ScanApi.get_report_log"
60
+ end
61
+ # verify the required parameter 'report_id' is set
62
+ if @api_client.config.client_side_validation && report_id.nil?
63
+ fail ArgumentError, "Missing the required parameter 'report_id' when calling ScanApi.get_report_log"
64
+ end
65
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
66
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ScanApi.get_report_log, the character length must be great than or equal to 1.'
67
+ end
68
+
69
+ # resource path
70
+ local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan/{report_id}/log'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.to_s).sub('{' + 'report_id' + '}', report_id.to_s)
71
+
72
+ # query parameters
73
+ query_params = {}
74
+
75
+ # header parameters
76
+ header_params = {}
77
+ # HTTP header 'Accept' (if needed)
78
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain'])
79
+ # HTTP header 'Content-Type'
80
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
81
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
82
+
83
+ # form parameters
84
+ form_params = {}
85
+
86
+ # http body (model)
87
+ post_body = nil
88
+ auth_names = ['basic']
89
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
90
+ :header_params => header_params,
91
+ :query_params => query_params,
92
+ :form_params => form_params,
93
+ :body => post_body,
94
+ :auth_names => auth_names,
95
+ :return_type => 'String')
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug "API called: ScanApi#get_report_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ end
99
+ return data, status_code, headers
100
+ end
101
+ # Scan the artifact
102
+ # Scan the specified artifact
103
+ # @param project_name The name of the project
104
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb
105
+ # @param reference The reference of the artifact, can be digest or tag
106
+ # @param [Hash] opts the optional parameters
107
+ # @option opts [String] :x_request_id An unique ID for the request
108
+ # @return [nil]
109
+ def scan_artifact(project_name, repository_name, reference, opts = {})
110
+ scan_artifact_with_http_info(project_name, repository_name, reference, opts)
111
+ nil
112
+ end
113
+
114
+ # Scan the artifact
115
+ # Scan the specified artifact
116
+ # @param project_name The name of the project
117
+ # @param repository_name The name of the repository. If it contains slash, encode it with URL encoding. e.g. a/b -&gt; a%252Fb
118
+ # @param reference The reference of the artifact, can be digest or tag
119
+ # @param [Hash] opts the optional parameters
120
+ # @option opts [String] :x_request_id An unique ID for the request
121
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
122
+ def scan_artifact_with_http_info(project_name, repository_name, reference, opts = {})
123
+ if @api_client.config.debugging
124
+ @api_client.config.logger.debug 'Calling API: ScanApi.scan_artifact ...'
125
+ end
126
+ # verify the required parameter 'project_name' is set
127
+ if @api_client.config.client_side_validation && project_name.nil?
128
+ fail ArgumentError, "Missing the required parameter 'project_name' when calling ScanApi.scan_artifact"
129
+ end
130
+ # verify the required parameter 'repository_name' is set
131
+ if @api_client.config.client_side_validation && repository_name.nil?
132
+ fail ArgumentError, "Missing the required parameter 'repository_name' when calling ScanApi.scan_artifact"
133
+ end
134
+ # verify the required parameter 'reference' is set
135
+ if @api_client.config.client_side_validation && reference.nil?
136
+ fail ArgumentError, "Missing the required parameter 'reference' when calling ScanApi.scan_artifact"
137
+ end
138
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
139
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ScanApi.scan_artifact, the character length must be great than or equal to 1.'
140
+ end
141
+
142
+ # resource path
143
+ local_var_path = '/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/scan'.sub('{' + 'project_name' + '}', project_name.to_s).sub('{' + 'repository_name' + '}', repository_name.to_s).sub('{' + 'reference' + '}', reference.to_s)
144
+
145
+ # query parameters
146
+ query_params = {}
147
+
148
+ # header parameters
149
+ header_params = {}
150
+ # HTTP header 'Accept' (if needed)
151
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
152
+ # HTTP header 'Content-Type'
153
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
154
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
155
+
156
+ # form parameters
157
+ form_params = {}
158
+
159
+ # http body (model)
160
+ post_body = nil
161
+ auth_names = ['basic']
162
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
163
+ :header_params => header_params,
164
+ :query_params => query_params,
165
+ :form_params => form_params,
166
+ :body => post_body,
167
+ :auth_names => auth_names)
168
+ if @api_client.config.debugging
169
+ @api_client.config.logger.debug "API called: ScanApi#scan_artifact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
170
+ end
171
+ return data, status_code, headers
172
+ end
173
+ end
174
+ end