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,601 @@
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 ProjectApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a new project.
23
+ # This endpoint is for user to create a new project.
24
+ # @param project New created project.
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :x_request_id An unique ID for the request
27
+ # @return [nil]
28
+ def create_project(project, opts = {})
29
+ create_project_with_http_info(project, opts)
30
+ nil
31
+ end
32
+
33
+ # Create a new project.
34
+ # This endpoint is for user to create a new project.
35
+ # @param project New created project.
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :x_request_id An unique ID for the request
38
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
39
+ def create_project_with_http_info(project, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'
42
+ end
43
+ # verify the required parameter 'project' is set
44
+ if @api_client.config.client_side_validation && project.nil?
45
+ fail ArgumentError, "Missing the required parameter 'project' when calling ProjectApi.create_project"
46
+ end
47
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
48
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.create_project, the character length must be great than or equal to 1.'
49
+ end
50
+
51
+ # resource path
52
+ local_var_path = '/projects'
53
+
54
+ # query parameters
55
+ query_params = {}
56
+
57
+ # header parameters
58
+ header_params = {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+ # HTTP header 'Content-Type'
62
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
63
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
64
+
65
+ # form parameters
66
+ form_params = {}
67
+
68
+ # http body (model)
69
+ post_body = @api_client.object_to_http_body(project)
70
+ auth_names = ['basic']
71
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
72
+ :header_params => header_params,
73
+ :query_params => query_params,
74
+ :form_params => form_params,
75
+ :body => post_body,
76
+ :auth_names => auth_names)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: ProjectApi#create_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+ # Delete project by projectID
83
+ # This endpoint is aimed to delete project by project ID.
84
+ # @param project_id The ID of the project
85
+ # @param [Hash] opts the optional parameters
86
+ # @option opts [String] :x_request_id An unique ID for the request
87
+ # @return [nil]
88
+ def delete_project(project_id, opts = {})
89
+ delete_project_with_http_info(project_id, opts)
90
+ nil
91
+ end
92
+
93
+ # Delete project by projectID
94
+ # This endpoint is aimed to delete project by project ID.
95
+ # @param project_id The ID of the project
96
+ # @param [Hash] opts the optional parameters
97
+ # @option opts [String] :x_request_id An unique ID for the request
98
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
99
+ def delete_project_with_http_info(project_id, opts = {})
100
+ if @api_client.config.debugging
101
+ @api_client.config.logger.debug 'Calling API: ProjectApi.delete_project ...'
102
+ end
103
+ # verify the required parameter 'project_id' is set
104
+ if @api_client.config.client_side_validation && project_id.nil?
105
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectApi.delete_project"
106
+ end
107
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
108
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.delete_project, the character length must be great than or equal to 1.'
109
+ end
110
+
111
+ # resource path
112
+ local_var_path = '/projects/{project_id}'.sub('{' + 'project_id' + '}', project_id.to_s)
113
+
114
+ # query parameters
115
+ query_params = {}
116
+
117
+ # header parameters
118
+ header_params = {}
119
+ # HTTP header 'Accept' (if needed)
120
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
121
+ # HTTP header 'Content-Type'
122
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
123
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
124
+
125
+ # form parameters
126
+ form_params = {}
127
+
128
+ # http body (model)
129
+ post_body = nil
130
+ auth_names = ['basic']
131
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
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
+ if @api_client.config.debugging
138
+ @api_client.config.logger.debug "API called: ProjectApi#delete_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
139
+ end
140
+ return data, status_code, headers
141
+ end
142
+ # Get recent logs of the projects
143
+ # Get recent logs of the projects
144
+ # @param project_name The name of the project
145
+ # @param [Hash] opts the optional parameters
146
+ # @option opts [String] :x_request_id An unique ID for the request
147
+ # @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]
148
+ # @option opts [Integer] :page The page number (default to 1)
149
+ # @option opts [Integer] :page_size The size of per page (default to 10)
150
+ # @return [Array<AuditLog>]
151
+ def get_logs(project_name, opts = {})
152
+ data, _status_code, _headers = get_logs_with_http_info(project_name, opts)
153
+ data
154
+ end
155
+
156
+ # Get recent logs of the projects
157
+ # Get recent logs of the projects
158
+ # @param project_name The name of the project
159
+ # @param [Hash] opts the optional parameters
160
+ # @option opts [String] :x_request_id An unique ID for the request
161
+ # @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]
162
+ # @option opts [Integer] :page The page number
163
+ # @option opts [Integer] :page_size The size of per page
164
+ # @return [Array<(Array<AuditLog>, Fixnum, Hash)>] Array<AuditLog> data, response status code and response headers
165
+ def get_logs_with_http_info(project_name, opts = {})
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug 'Calling API: ProjectApi.get_logs ...'
168
+ end
169
+ # verify the required parameter 'project_name' is set
170
+ if @api_client.config.client_side_validation && project_name.nil?
171
+ fail ArgumentError, "Missing the required parameter 'project_name' when calling ProjectApi.get_logs"
172
+ end
173
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
174
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.get_logs, the character length must be great than or equal to 1.'
175
+ end
176
+
177
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
178
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProjectApi.get_logs, must be smaller than or equal to 100.'
179
+ end
180
+
181
+ # resource path
182
+ local_var_path = '/projects/{project_name}/logs'.sub('{' + 'project_name' + '}', project_name.to_s)
183
+
184
+ # query parameters
185
+ query_params = {}
186
+ query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
187
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
188
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
189
+
190
+ # header parameters
191
+ header_params = {}
192
+ # HTTP header 'Accept' (if needed)
193
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
194
+ # HTTP header 'Content-Type'
195
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
196
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
197
+
198
+ # form parameters
199
+ form_params = {}
200
+
201
+ # http body (model)
202
+ post_body = nil
203
+ auth_names = ['basic']
204
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
205
+ :header_params => header_params,
206
+ :query_params => query_params,
207
+ :form_params => form_params,
208
+ :body => post_body,
209
+ :auth_names => auth_names,
210
+ :return_type => 'Array<AuditLog>')
211
+ if @api_client.config.debugging
212
+ @api_client.config.logger.debug "API called: ProjectApi#get_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
213
+ end
214
+ return data, status_code, headers
215
+ end
216
+ # Return specific project detail information
217
+ # This endpoint returns specific project information by project ID.
218
+ # @param project_id The ID of the project
219
+ # @param [Hash] opts the optional parameters
220
+ # @option opts [String] :x_request_id An unique ID for the request
221
+ # @return [Project]
222
+ def get_project(project_id, opts = {})
223
+ data, _status_code, _headers = get_project_with_http_info(project_id, opts)
224
+ data
225
+ end
226
+
227
+ # Return specific project detail information
228
+ # This endpoint returns specific project information by project ID.
229
+ # @param project_id The ID of the project
230
+ # @param [Hash] opts the optional parameters
231
+ # @option opts [String] :x_request_id An unique ID for the request
232
+ # @return [Array<(Project, Fixnum, Hash)>] Project data, response status code and response headers
233
+ def get_project_with_http_info(project_id, opts = {})
234
+ if @api_client.config.debugging
235
+ @api_client.config.logger.debug 'Calling API: ProjectApi.get_project ...'
236
+ end
237
+ # verify the required parameter 'project_id' is set
238
+ if @api_client.config.client_side_validation && project_id.nil?
239
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectApi.get_project"
240
+ end
241
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
242
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.get_project, the character length must be great than or equal to 1.'
243
+ end
244
+
245
+ # resource path
246
+ local_var_path = '/projects/{project_id}'.sub('{' + 'project_id' + '}', project_id.to_s)
247
+
248
+ # query parameters
249
+ query_params = {}
250
+
251
+ # header parameters
252
+ header_params = {}
253
+ # HTTP header 'Accept' (if needed)
254
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
255
+ # HTTP header 'Content-Type'
256
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
257
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
258
+
259
+ # form parameters
260
+ form_params = {}
261
+
262
+ # http body (model)
263
+ post_body = nil
264
+ auth_names = ['basic']
265
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
266
+ :header_params => header_params,
267
+ :query_params => query_params,
268
+ :form_params => form_params,
269
+ :body => post_body,
270
+ :auth_names => auth_names,
271
+ :return_type => 'Project')
272
+ if @api_client.config.debugging
273
+ @api_client.config.logger.debug "API called: ProjectApi#get_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
274
+ end
275
+ return data, status_code, headers
276
+ end
277
+ # Get the deletable status of the project
278
+ # Get the deletable status of the project
279
+ # @param project_id The ID of the project
280
+ # @param [Hash] opts the optional parameters
281
+ # @option opts [String] :x_request_id An unique ID for the request
282
+ # @return [ProjectDeletable]
283
+ def get_project_deletable(project_id, opts = {})
284
+ data, _status_code, _headers = get_project_deletable_with_http_info(project_id, opts)
285
+ data
286
+ end
287
+
288
+ # Get the deletable status of the project
289
+ # Get the deletable status of the project
290
+ # @param project_id The ID of the project
291
+ # @param [Hash] opts the optional parameters
292
+ # @option opts [String] :x_request_id An unique ID for the request
293
+ # @return [Array<(ProjectDeletable, Fixnum, Hash)>] ProjectDeletable data, response status code and response headers
294
+ def get_project_deletable_with_http_info(project_id, opts = {})
295
+ if @api_client.config.debugging
296
+ @api_client.config.logger.debug 'Calling API: ProjectApi.get_project_deletable ...'
297
+ end
298
+ # verify the required parameter 'project_id' is set
299
+ if @api_client.config.client_side_validation && project_id.nil?
300
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectApi.get_project_deletable"
301
+ end
302
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
303
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.get_project_deletable, the character length must be great than or equal to 1.'
304
+ end
305
+
306
+ # resource path
307
+ local_var_path = '/projects/{project_id}/_deletable'.sub('{' + 'project_id' + '}', project_id.to_s)
308
+
309
+ # query parameters
310
+ query_params = {}
311
+
312
+ # header parameters
313
+ header_params = {}
314
+ # HTTP header 'Accept' (if needed)
315
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
316
+ # HTTP header 'Content-Type'
317
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
318
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
319
+
320
+ # form parameters
321
+ form_params = {}
322
+
323
+ # http body (model)
324
+ post_body = nil
325
+ auth_names = ['basic']
326
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
327
+ :header_params => header_params,
328
+ :query_params => query_params,
329
+ :form_params => form_params,
330
+ :body => post_body,
331
+ :auth_names => auth_names,
332
+ :return_type => 'ProjectDeletable')
333
+ if @api_client.config.debugging
334
+ @api_client.config.logger.debug "API called: ProjectApi#get_project_deletable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
335
+ end
336
+ return data, status_code, headers
337
+ end
338
+ # Get summary of the project.
339
+ # Get summary of the project.
340
+ # @param project_id The ID of the project
341
+ # @param [Hash] opts the optional parameters
342
+ # @option opts [String] :x_request_id An unique ID for the request
343
+ # @return [ProjectSummary]
344
+ def get_project_summary(project_id, opts = {})
345
+ data, _status_code, _headers = get_project_summary_with_http_info(project_id, opts)
346
+ data
347
+ end
348
+
349
+ # Get summary of the project.
350
+ # Get summary of the project.
351
+ # @param project_id The ID of the project
352
+ # @param [Hash] opts the optional parameters
353
+ # @option opts [String] :x_request_id An unique ID for the request
354
+ # @return [Array<(ProjectSummary, Fixnum, Hash)>] ProjectSummary data, response status code and response headers
355
+ def get_project_summary_with_http_info(project_id, opts = {})
356
+ if @api_client.config.debugging
357
+ @api_client.config.logger.debug 'Calling API: ProjectApi.get_project_summary ...'
358
+ end
359
+ # verify the required parameter 'project_id' is set
360
+ if @api_client.config.client_side_validation && project_id.nil?
361
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectApi.get_project_summary"
362
+ end
363
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
364
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.get_project_summary, the character length must be great than or equal to 1.'
365
+ end
366
+
367
+ # resource path
368
+ local_var_path = '/projects/{project_id}/summary'.sub('{' + 'project_id' + '}', project_id.to_s)
369
+
370
+ # query parameters
371
+ query_params = {}
372
+
373
+ # header parameters
374
+ header_params = {}
375
+ # HTTP header 'Accept' (if needed)
376
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
377
+ # HTTP header 'Content-Type'
378
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
379
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
380
+
381
+ # form parameters
382
+ form_params = {}
383
+
384
+ # http body (model)
385
+ post_body = nil
386
+ auth_names = ['basic']
387
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
388
+ :header_params => header_params,
389
+ :query_params => query_params,
390
+ :form_params => form_params,
391
+ :body => post_body,
392
+ :auth_names => auth_names,
393
+ :return_type => 'ProjectSummary')
394
+ if @api_client.config.debugging
395
+ @api_client.config.logger.debug "API called: ProjectApi#get_project_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
396
+ end
397
+ return data, status_code, headers
398
+ end
399
+ # Check if the project name user provided already exists.
400
+ # This endpoint is used to check if the project name provided already exist.
401
+ # @param project_name Project name for checking exists.
402
+ # @param [Hash] opts the optional parameters
403
+ # @option opts [String] :x_request_id An unique ID for the request
404
+ # @return [nil]
405
+ def head_project(project_name, opts = {})
406
+ head_project_with_http_info(project_name, opts)
407
+ nil
408
+ end
409
+
410
+ # Check if the project name user provided already exists.
411
+ # This endpoint is used to check if the project name provided already exist.
412
+ # @param project_name Project name for checking exists.
413
+ # @param [Hash] opts the optional parameters
414
+ # @option opts [String] :x_request_id An unique ID for the request
415
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
416
+ def head_project_with_http_info(project_name, opts = {})
417
+ if @api_client.config.debugging
418
+ @api_client.config.logger.debug 'Calling API: ProjectApi.head_project ...'
419
+ end
420
+ # verify the required parameter 'project_name' is set
421
+ if @api_client.config.client_side_validation && project_name.nil?
422
+ fail ArgumentError, "Missing the required parameter 'project_name' when calling ProjectApi.head_project"
423
+ end
424
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
425
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.head_project, the character length must be great than or equal to 1.'
426
+ end
427
+
428
+ # resource path
429
+ local_var_path = '/projects'
430
+
431
+ # query parameters
432
+ query_params = {}
433
+ query_params[:'project_name'] = project_name
434
+
435
+ # header parameters
436
+ header_params = {}
437
+ # HTTP header 'Accept' (if needed)
438
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
439
+ # HTTP header 'Content-Type'
440
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
441
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
442
+
443
+ # form parameters
444
+ form_params = {}
445
+
446
+ # http body (model)
447
+ post_body = nil
448
+ auth_names = ['basic']
449
+ data, status_code, headers = @api_client.call_api(:HEAD, local_var_path,
450
+ :header_params => header_params,
451
+ :query_params => query_params,
452
+ :form_params => form_params,
453
+ :body => post_body,
454
+ :auth_names => auth_names)
455
+ if @api_client.config.debugging
456
+ @api_client.config.logger.debug "API called: ProjectApi#head_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
457
+ end
458
+ return data, status_code, headers
459
+ end
460
+ # List projects
461
+ # This endpoint returns projects created by Harbor.
462
+ # @param [Hash] opts the optional parameters
463
+ # @option opts [String] :x_request_id An unique ID for the request
464
+ # @option opts [Integer] :page The page number (default to 1)
465
+ # @option opts [Integer] :page_size The size of per page (default to 10)
466
+ # @option opts [String] :name The name of project.
467
+ # @option opts [BOOLEAN] :public The project is public or private.
468
+ # @option opts [String] :owner The name of project owner.
469
+ # @return [Array<Project>]
470
+ def list_projects(opts = {})
471
+ data, _status_code, _headers = list_projects_with_http_info(opts)
472
+ data
473
+ end
474
+
475
+ # List projects
476
+ # This endpoint returns projects created by Harbor.
477
+ # @param [Hash] opts the optional parameters
478
+ # @option opts [String] :x_request_id An unique ID for the request
479
+ # @option opts [Integer] :page The page number
480
+ # @option opts [Integer] :page_size The size of per page
481
+ # @option opts [String] :name The name of project.
482
+ # @option opts [BOOLEAN] :public The project is public or private.
483
+ # @option opts [String] :owner The name of project owner.
484
+ # @return [Array<(Array<Project>, Fixnum, Hash)>] Array<Project> data, response status code and response headers
485
+ def list_projects_with_http_info(opts = {})
486
+ if @api_client.config.debugging
487
+ @api_client.config.logger.debug 'Calling API: ProjectApi.list_projects ...'
488
+ end
489
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
490
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.list_projects, the character length must be great than or equal to 1.'
491
+ end
492
+
493
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
494
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProjectApi.list_projects, must be smaller than or equal to 100.'
495
+ end
496
+
497
+ # resource path
498
+ local_var_path = '/projects'
499
+
500
+ # query parameters
501
+ query_params = {}
502
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
503
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
504
+ query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
505
+ query_params[:'public'] = opts[:'public'] if !opts[:'public'].nil?
506
+ query_params[:'owner'] = opts[:'owner'] if !opts[:'owner'].nil?
507
+
508
+ # header parameters
509
+ header_params = {}
510
+ # HTTP header 'Accept' (if needed)
511
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
512
+ # HTTP header 'Content-Type'
513
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
514
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
515
+
516
+ # form parameters
517
+ form_params = {}
518
+
519
+ # http body (model)
520
+ post_body = nil
521
+ auth_names = ['basic']
522
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
523
+ :header_params => header_params,
524
+ :query_params => query_params,
525
+ :form_params => form_params,
526
+ :body => post_body,
527
+ :auth_names => auth_names,
528
+ :return_type => 'Array<Project>')
529
+ if @api_client.config.debugging
530
+ @api_client.config.logger.debug "API called: ProjectApi#list_projects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
531
+ end
532
+ return data, status_code, headers
533
+ end
534
+ # Update properties for a selected project.
535
+ # This endpoint is aimed to update the properties of a project.
536
+ # @param project_id The ID of the project
537
+ # @param project Updates of project.
538
+ # @param [Hash] opts the optional parameters
539
+ # @option opts [String] :x_request_id An unique ID for the request
540
+ # @return [nil]
541
+ def update_project(project_id, project, opts = {})
542
+ update_project_with_http_info(project_id, project, opts)
543
+ nil
544
+ end
545
+
546
+ # Update properties for a selected project.
547
+ # This endpoint is aimed to update the properties of a project.
548
+ # @param project_id The ID of the project
549
+ # @param project Updates of project.
550
+ # @param [Hash] opts the optional parameters
551
+ # @option opts [String] :x_request_id An unique ID for the request
552
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
553
+ def update_project_with_http_info(project_id, project, opts = {})
554
+ if @api_client.config.debugging
555
+ @api_client.config.logger.debug 'Calling API: ProjectApi.update_project ...'
556
+ end
557
+ # verify the required parameter 'project_id' is set
558
+ if @api_client.config.client_side_validation && project_id.nil?
559
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectApi.update_project"
560
+ end
561
+ # verify the required parameter 'project' is set
562
+ if @api_client.config.client_side_validation && project.nil?
563
+ fail ArgumentError, "Missing the required parameter 'project' when calling ProjectApi.update_project"
564
+ end
565
+ if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
566
+ fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.update_project, the character length must be great than or equal to 1.'
567
+ end
568
+
569
+ # resource path
570
+ local_var_path = '/projects/{project_id}'.sub('{' + 'project_id' + '}', project_id.to_s)
571
+
572
+ # query parameters
573
+ query_params = {}
574
+
575
+ # header parameters
576
+ header_params = {}
577
+ # HTTP header 'Accept' (if needed)
578
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
579
+ # HTTP header 'Content-Type'
580
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
581
+ header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
582
+
583
+ # form parameters
584
+ form_params = {}
585
+
586
+ # http body (model)
587
+ post_body = @api_client.object_to_http_body(project)
588
+ auth_names = ['basic']
589
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
590
+ :header_params => header_params,
591
+ :query_params => query_params,
592
+ :form_params => form_params,
593
+ :body => post_body,
594
+ :auth_names => auth_names)
595
+ if @api_client.config.debugging
596
+ @api_client.config.logger.debug "API called: ProjectApi#update_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
597
+ end
598
+ return data, status_code, headers
599
+ end
600
+ end
601
+ end