Class: Harbor2Client::ProjectApi

Inherits:
Object
  • Object
show all
Defined in:
lib/harbor2_client/api/project_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProjectApi

Returns a new instance of ProjectApi.



19
20
21
# File 'lib/harbor2_client/api/project_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/harbor2_client/api/project_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_project(project, opts = {}) ⇒ nil

Create a new project. This endpoint is for user to create a new project.

Parameters:

  • project

    New created project.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_resource_name_in_location (BOOLEAN)

    The flag to indicate whether to return the name of the resource in Location. When X-Resource-Name-In-Location is true, the Location will return the name of the resource. (default to false)

Returns:

  • (nil)


29
30
31
32
# File 'lib/harbor2_client/api/project_api.rb', line 29

def create_project(project, opts = {})
  create_project_with_http_info(project, opts)
  nil
end

#create_project_with_http_info(project, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create a new project. This endpoint is for user to create a new project.

Parameters:

  • project

    New created project.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_resource_name_in_location (BOOLEAN)

    The flag to indicate whether to return the name of the resource in Location. When X-Resource-Name-In-Location is true, the Location will return the name of the resource.

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/harbor2_client/api/project_api.rb', line 41

def create_project_with_http_info(project, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'
  end
  # verify the required parameter 'project' is set
  if @api_client.config.client_side_validation && project.nil?
    fail ArgumentError, "Missing the required parameter 'project' when calling ProjectApi.create_project"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    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.'
  end

  # resource path
  local_var_path = '/projects'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
  header_params[:'X-Resource-Name-In-Location'] = opts[:'x_resource_name_in_location'] if !opts[:'x_resource_name_in_location'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(project)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#create_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_project(project_name_or_id, opts = {}) ⇒ nil

Delete project by projectID This endpoint is aimed to delete project by project ID.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

Returns:

  • (nil)


92
93
94
95
# File 'lib/harbor2_client/api/project_api.rb', line 92

def delete_project(project_name_or_id, opts = {})
  delete_project_with_http_info(project_name_or_id, opts)
  nil
end

#delete_project_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete project by projectID This endpoint is aimed to delete project by project ID.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/harbor2_client/api/project_api.rb', line 104

def delete_project_with_http_info(project_name_or_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.delete_project ...'
  end
  # verify the required parameter 'project_name_or_id' is set
  if @api_client.config.client_side_validation && project_name_or_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_name_or_id' when calling ProjectApi.delete_project"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    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.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#delete_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_logs(project_name, opts = {}) ⇒ Array<AuditLog>

Get recent logs of the projects Get recent logs of the projects

Parameters:

  • project_name

    The name of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :q (String)

    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;)&quot;, &quot;list with union releationship(k&#x3D;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;

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :page (Integer)

    The page number (default to 1)

  • :page_size (Integer)

    The size of per page (default to 10)

Returns:



158
159
160
161
# File 'lib/harbor2_client/api/project_api.rb', line 158

def get_logs(project_name, opts = {})
  data, _status_code, _headers = get_logs_with_http_info(project_name, opts)
  data
end

#get_logs_with_http_info(project_name, opts = {}) ⇒ Array<(Array<AuditLog>, Fixnum, Hash)>

Get recent logs of the projects Get recent logs of the projects

Parameters:

  • project_name

    The name of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :q (String)

    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;)&quot;, &quot;list with union releationship(k&#x3D;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;

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :page (Integer)

    The page number

  • :page_size (Integer)

    The size of per page

Returns:

  • (Array<(Array<AuditLog>, Fixnum, Hash)>)

    Array<AuditLog> data, response status code and response headers



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/harbor2_client/api/project_api.rb', line 173

def get_logs_with_http_info(project_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.get_logs ...'
  end
  # verify the required parameter 'project_name' is set
  if @api_client.config.client_side_validation && project_name.nil?
    fail ArgumentError, "Missing the required parameter 'project_name' when calling ProjectApi.get_logs"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    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.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProjectApi.get_logs, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/projects/{project_name}/logs'.sub('{' + 'project_name' + '}', project_name.to_s)

  # query parameters
  query_params = {}
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<AuditLog>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#get_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_project(project_name_or_id, opts = {}) ⇒ Project

Return specific project detail information This endpoint returns specific project information by project ID.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

Returns:



232
233
234
235
# File 'lib/harbor2_client/api/project_api.rb', line 232

def get_project(project_name_or_id, opts = {})
  data, _status_code, _headers = get_project_with_http_info(project_name_or_id, opts)
  data
end

#get_project_deletable(project_name_or_id, opts = {}) ⇒ ProjectDeletable

Get the deletable status of the project Get the deletable status of the project

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

Returns:



296
297
298
299
# File 'lib/harbor2_client/api/project_api.rb', line 296

def get_project_deletable(project_name_or_id, opts = {})
  data, _status_code, _headers = get_project_deletable_with_http_info(project_name_or_id, opts)
  data
end

#get_project_deletable_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(ProjectDeletable, Fixnum, Hash)>

Get the deletable status of the project Get the deletable status of the project

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

Returns:

  • (Array<(ProjectDeletable, Fixnum, Hash)>)

    ProjectDeletable data, response status code and response headers



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/harbor2_client/api/project_api.rb', line 308

def get_project_deletable_with_http_info(project_name_or_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.get_project_deletable ...'
  end
  # verify the required parameter 'project_name_or_id' is set
  if @api_client.config.client_side_validation && project_name_or_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_name_or_id' when calling ProjectApi.get_project_deletable"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    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.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/_deletable'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ProjectDeletable')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#get_project_deletable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_project_summary(project_name_or_id, opts = {}) ⇒ ProjectSummary

Get summary of the project. Get summary of the project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

Returns:



360
361
362
363
# File 'lib/harbor2_client/api/project_api.rb', line 360

def get_project_summary(project_name_or_id, opts = {})
  data, _status_code, _headers = get_project_summary_with_http_info(project_name_or_id, opts)
  data
end

#get_project_summary_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(ProjectSummary, Fixnum, Hash)>

Get summary of the project. Get summary of the project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

Returns:

  • (Array<(ProjectSummary, Fixnum, Hash)>)

    ProjectSummary data, response status code and response headers



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/harbor2_client/api/project_api.rb', line 372

def get_project_summary_with_http_info(project_name_or_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.get_project_summary ...'
  end
  # verify the required parameter 'project_name_or_id' is set
  if @api_client.config.client_side_validation && project_name_or_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_name_or_id' when calling ProjectApi.get_project_summary"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    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.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/summary'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ProjectSummary')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#get_project_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_project_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(Project, Fixnum, Hash)>

Return specific project detail information This endpoint returns specific project information by project ID.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

Returns:

  • (Array<(Project, Fixnum, Hash)>)

    Project data, response status code and response headers



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/harbor2_client/api/project_api.rb', line 244

def get_project_with_http_info(project_name_or_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.get_project ...'
  end
  # verify the required parameter 'project_name_or_id' is set
  if @api_client.config.client_side_validation && project_name_or_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_name_or_id' when calling ProjectApi.get_project"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    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.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Project')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#get_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_scanner_of_project(project_name_or_id, opts = {}) ⇒ ScannerRegistration

Get project level scanner Get the scanner registration of the specified project. If no scanner registration is configured for the specified project, the system default scanner registration will be returned.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

Returns:



424
425
426
427
# File 'lib/harbor2_client/api/project_api.rb', line 424

def get_scanner_of_project(project_name_or_id, opts = {})
  data, _status_code, _headers = get_scanner_of_project_with_http_info(project_name_or_id, opts)
  data
end

#get_scanner_of_project_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(ScannerRegistration, Fixnum, Hash)>

Get project level scanner Get the scanner registration of the specified project. If no scanner registration is configured for the specified project, the system default scanner registration will be returned.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

Returns:

  • (Array<(ScannerRegistration, Fixnum, Hash)>)

    ScannerRegistration data, response status code and response headers



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/harbor2_client/api/project_api.rb', line 436

def get_scanner_of_project_with_http_info(project_name_or_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.get_scanner_of_project ...'
  end
  # verify the required parameter 'project_name_or_id' is set
  if @api_client.config.client_side_validation && project_name_or_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_name_or_id' when calling ProjectApi.get_scanner_of_project"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.get_scanner_of_project, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/scanner'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ScannerRegistration')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#get_scanner_of_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#head_project(project_name, opts = {}) ⇒ nil

Check if the project name user provided already exists. This endpoint is used to check if the project name provided already exist.

Parameters:

  • project_name

    Project name for checking exists.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


487
488
489
490
# File 'lib/harbor2_client/api/project_api.rb', line 487

def head_project(project_name, opts = {})
  head_project_with_http_info(project_name, opts)
  nil
end

#head_project_with_http_info(project_name, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Check if the project name user provided already exists. This endpoint is used to check if the project name provided already exist.

Parameters:

  • project_name

    Project name for checking exists.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/harbor2_client/api/project_api.rb', line 498

def head_project_with_http_info(project_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.head_project ...'
  end
  # verify the required parameter 'project_name' is set
  if @api_client.config.client_side_validation && project_name.nil?
    fail ArgumentError, "Missing the required parameter 'project_name' when calling ProjectApi.head_project"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    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.'
  end

  # resource path
  local_var_path = '/projects'

  # query parameters
  query_params = {}
  query_params[:'project_name'] = project_name

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:HEAD, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#head_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_projects(opts = {}) ⇒ Array<Project>

List projects This endpoint returns projects created by Harbor.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :q (String)

    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;)&quot;, &quot;list with union releationship(k&#x3D;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;

  • :page (Integer)

    The page number (default to 1)

  • :page_size (Integer)

    The size of per page (default to 10)

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :name (String)

    The name of project.

  • :public (BOOLEAN)

    The project is public or private.

  • :owner (String)

    The name of project owner.

  • :with_detail (BOOLEAN)

    Bool value indicating whether return detailed information of the project (default to true)

Returns:



555
556
557
558
# File 'lib/harbor2_client/api/project_api.rb', line 555

def list_projects(opts = {})
  data, _status_code, _headers = list_projects_with_http_info(opts)
  data
end

#list_projects_with_http_info(opts = {}) ⇒ Array<(Array<Project>, Fixnum, Hash)>

List projects This endpoint returns projects created by Harbor.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :q (String)

    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;)&quot;, &quot;list with union releationship(k&#x3D;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;

  • :page (Integer)

    The page number

  • :page_size (Integer)

    The size of per page

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :name (String)

    The name of project.

  • :public (BOOLEAN)

    The project is public or private.

  • :owner (String)

    The name of project owner.

  • :with_detail (BOOLEAN)

    Bool value indicating whether return detailed information of the project

Returns:

  • (Array<(Array<Project>, Fixnum, Hash)>)

    Array<Project> data, response status code and response headers



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
# File 'lib/harbor2_client/api/project_api.rb', line 573

def list_projects_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.list_projects ...'
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    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.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProjectApi.list_projects, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/projects'

  # query parameters
  query_params = {}
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'public'] = opts[:'public'] if !opts[:'public'].nil?
  query_params[:'owner'] = opts[:'owner'] if !opts[:'owner'].nil?
  query_params[:'with_detail'] = opts[:'with_detail'] if !opts[:'with_detail'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Project>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#list_projects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_scanner_candidates_of_project(project_name_or_id, opts = {}) ⇒ Array<ScannerRegistration>

Get scanner registration candidates for configurating project level scanner Retrieve the system configured scanner registrations as candidates of setting project level scanner.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

  • :q (String)

    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;)&quot;, &quot;list with union releationship(k&#x3D;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;

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :page (Integer)

    The page number (default to 1)

  • :page_size (Integer)

    The size of per page (default to 10)

Returns:



636
637
638
639
# File 'lib/harbor2_client/api/project_api.rb', line 636

def list_scanner_candidates_of_project(project_name_or_id, opts = {})
  data, _status_code, _headers = list_scanner_candidates_of_project_with_http_info(project_name_or_id, opts)
  data
end

#list_scanner_candidates_of_project_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(Array<ScannerRegistration>, Fixnum, Hash)>

Get scanner registration candidates for configurating project level scanner Retrieve the system configured scanner registrations as candidates of setting project level scanner.

Parameters:

  • project_name_or_id

    The name or id of the project

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

  • :q (String)

    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;)&quot;, &quot;list with union releationship(k&#x3D;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;

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :page (Integer)

    The page number

  • :page_size (Integer)

    The size of per page

Returns:

  • (Array<(Array<ScannerRegistration>, Fixnum, Hash)>)

    Array<ScannerRegistration> data, response status code and response headers



652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
# File 'lib/harbor2_client/api/project_api.rb', line 652

def list_scanner_candidates_of_project_with_http_info(project_name_or_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.list_scanner_candidates_of_project ...'
  end
  # verify the required parameter 'project_name_or_id' is set
  if @api_client.config.client_side_validation && project_name_or_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_name_or_id' when calling ProjectApi.list_scanner_candidates_of_project"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.list_scanner_candidates_of_project, the character length must be great than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProjectApi.list_scanner_candidates_of_project, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/scanner/candidates'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<ScannerRegistration>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#list_scanner_candidates_of_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_scanner_of_project(project_name_or_id, payload, opts = {}) ⇒ nil

Configure scanner for the specified project Set one of the system configured scanner registration as the indepndent scanner of the specified project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • payload
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

Returns:

  • (nil)


713
714
715
716
# File 'lib/harbor2_client/api/project_api.rb', line 713

def set_scanner_of_project(project_name_or_id, payload, opts = {})
  set_scanner_of_project_with_http_info(project_name_or_id, payload, opts)
  nil
end

#set_scanner_of_project_with_http_info(project_name_or_id, payload, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Configure scanner for the specified project Set one of the system configured scanner registration as the indepndent scanner of the specified project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • payload
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
# File 'lib/harbor2_client/api/project_api.rb', line 726

def set_scanner_of_project_with_http_info(project_name_or_id, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.set_scanner_of_project ...'
  end
  # verify the required parameter 'project_name_or_id' is set
  if @api_client.config.client_side_validation && project_name_or_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_name_or_id' when calling ProjectApi.set_scanner_of_project"
  end
  # verify the required parameter 'payload' is set
  if @api_client.config.client_side_validation && payload.nil?
    fail ArgumentError, "Missing the required parameter 'payload' when calling ProjectApi.set_scanner_of_project"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling ProjectApi.set_scanner_of_project, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/scanner'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(payload)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#set_scanner_of_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_project(project_name_or_id, project, opts = {}) ⇒ nil

Update properties for a selected project. This endpoint is aimed to update the properties of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • project

    Updates of project.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

Returns:

  • (nil)


782
783
784
785
# File 'lib/harbor2_client/api/project_api.rb', line 782

def update_project(project_name_or_id, project, opts = {})
  update_project_with_http_info(project_name_or_id, project, opts)
  nil
end

#update_project_with_http_info(project_name_or_id, project, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update properties for a selected project. This endpoint is aimed to update the properties of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • project

    Updates of project.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
# File 'lib/harbor2_client/api/project_api.rb', line 795

def update_project_with_http_info(project_name_or_id, project, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectApi.update_project ...'
  end
  # verify the required parameter 'project_name_or_id' is set
  if @api_client.config.client_side_validation && project_name_or_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_name_or_id' when calling ProjectApi.update_project"
  end
  # verify the required parameter 'project' is set
  if @api_client.config.client_side_validation && project.nil?
    fail ArgumentError, "Missing the required parameter 'project' when calling ProjectApi.update_project"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    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.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(project)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectApi#update_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end