Class: Harbor2Client::ScannerApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ScannerApi

Returns a new instance of ScannerApi.



19
20
21
# File 'lib/harbor2_client/api/scanner_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/scanner_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_scanner(registration, opts = {}) ⇒ nil

Create a scanner registration Creats a new scanner registration with the given data.

Parameters:

  • registration

    A scanner registration to be created.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


28
29
30
31
# File 'lib/harbor2_client/api/scanner_api.rb', line 28

def create_scanner(registration, opts = {})
  create_scanner_with_http_info(registration, opts)
  nil
end

#create_scanner_with_http_info(registration, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create a scanner registration Creats a new scanner registration with the given data.

Parameters:

  • registration

    A scanner registration to be created.

  • 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



39
40
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
# File 'lib/harbor2_client/api/scanner_api.rb', line 39

def create_scanner_with_http_info(registration, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScannerApi.create_scanner ...'
  end
  # verify the required parameter 'registration' is set
  if @api_client.config.client_side_validation && registration.nil?
    fail ArgumentError, "Missing the required parameter 'registration' when calling ScannerApi.create_scanner"
  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 ScannerApi.create_scanner, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/scanners'

  # 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?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(registration)
  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: ScannerApi#create_scanner\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_scanner(registration_id, opts = {}) ⇒ ScannerRegistration

Delete a scanner registration Deletes the specified scanner registration.

Parameters:

  • registration_id

    The scanner registration identifier.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



88
89
90
91
# File 'lib/harbor2_client/api/scanner_api.rb', line 88

def delete_scanner(registration_id, opts = {})
  data, _status_code, _headers = delete_scanner_with_http_info(registration_id, opts)
  data
end

#delete_scanner_with_http_info(registration_id, opts = {}) ⇒ Array<(ScannerRegistration, Fixnum, Hash)>

Delete a scanner registration Deletes the specified scanner registration.

Parameters:

  • registration_id

    The scanner registration identifier.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    ScannerRegistration data, response status code and response headers



99
100
101
102
103
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
# File 'lib/harbor2_client/api/scanner_api.rb', line 99

def delete_scanner_with_http_info(registration_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScannerApi.delete_scanner ...'
  end
  # verify the required parameter 'registration_id' is set
  if @api_client.config.client_side_validation && registration_id.nil?
    fail ArgumentError, "Missing the required parameter 'registration_id' when calling ScannerApi.delete_scanner"
  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 ScannerApi.delete_scanner, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/scanners/{registration_id}'.sub('{' + 'registration_id' + '}', registration_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?

  # 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,
    :return_type => 'ScannerRegistration')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScannerApi#delete_scanner\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_scanner(registration_id, opts = {}) ⇒ ScannerRegistration

Get a scanner registration details Retruns the details of the specified scanner registration.

Parameters:

  • registration_id

    The scanner registration identifer.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



149
150
151
152
# File 'lib/harbor2_client/api/scanner_api.rb', line 149

def get_scanner(registration_id, opts = {})
  data, _status_code, _headers = get_scanner_with_http_info(registration_id, opts)
  data
end

#get_scanner_metadata(registration_id, opts = {}) ⇒ ScannerAdapterMetadata

Get the metadata of the specified scanner registration Get the metadata of the specified scanner registration, including the capabilities and customized properties.

Parameters:

  • registration_id

    The scanner registration identifier.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:



210
211
212
213
# File 'lib/harbor2_client/api/scanner_api.rb', line 210

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

#get_scanner_metadata_with_http_info(registration_id, opts = {}) ⇒ Array<(ScannerAdapterMetadata, Fixnum, Hash)>

Get the metadata of the specified scanner registration Get the metadata of the specified scanner registration, including the capabilities and customized properties.

Parameters:

  • registration_id

    The scanner registration identifier.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    ScannerAdapterMetadata data, response status code and response headers



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/harbor2_client/api/scanner_api.rb', line 221

def (registration_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScannerApi.get_scanner_metadata ...'
  end
  # verify the required parameter 'registration_id' is set
  if @api_client.config.client_side_validation && registration_id.nil?
    fail ArgumentError, "Missing the required parameter 'registration_id' when calling ScannerApi.get_scanner_metadata"
  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 ScannerApi.get_scanner_metadata, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/scanners/{registration_id}/metadata'.sub('{' + 'registration_id' + '}', registration_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?

  # 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 => 'ScannerAdapterMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScannerApi#get_scanner_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_scanner_with_http_info(registration_id, opts = {}) ⇒ Array<(ScannerRegistration, Fixnum, Hash)>

Get a scanner registration details Retruns the details of the specified scanner registration.

Parameters:

  • registration_id

    The scanner registration identifer.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

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

    ScannerRegistration data, response status code and response headers



160
161
162
163
164
165
166
167
168
169
170
171
172
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
# File 'lib/harbor2_client/api/scanner_api.rb', line 160

def get_scanner_with_http_info(registration_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScannerApi.get_scanner ...'
  end
  # verify the required parameter 'registration_id' is set
  if @api_client.config.client_side_validation && registration_id.nil?
    fail ArgumentError, "Missing the required parameter 'registration_id' when calling ScannerApi.get_scanner"
  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 ScannerApi.get_scanner, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/scanners/{registration_id}'.sub('{' + 'registration_id' + '}', registration_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?

  # 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: ScannerApi#get_scanner\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_scanners(opts = {}) ⇒ Array<ScannerRegistration>

List scanner registrations Returns a list of currently configured scanner registrations.

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;

  • :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:



274
275
276
277
# File 'lib/harbor2_client/api/scanner_api.rb', line 274

def list_scanners(opts = {})
  data, _status_code, _headers = list_scanners_with_http_info(opts)
  data
end

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

List scanner registrations Returns a list of currently configured scanner registrations.

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;

  • :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



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
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
# File 'lib/harbor2_client/api/scanner_api.rb', line 288

def list_scanners_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScannerApi.list_scanners ...'
  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 ScannerApi.list_scanners, 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 ScannerApi.list_scanners, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/scanners'

  # 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<ScannerRegistration>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScannerApi#list_scanners\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#ping_scanner(settings, opts = {}) ⇒ nil

Tests scanner registration settings Pings scanner adapter to test endpoint URL and authorization settings.

Parameters:

  • settings

    A scanner registration settings to be tested.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


342
343
344
345
# File 'lib/harbor2_client/api/scanner_api.rb', line 342

def ping_scanner(settings, opts = {})
  ping_scanner_with_http_info(settings, opts)
  nil
end

#ping_scanner_with_http_info(settings, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Tests scanner registration settings Pings scanner adapter to test endpoint URL and authorization settings.

Parameters:

  • settings

    A scanner registration settings to be tested.

  • 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



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/harbor2_client/api/scanner_api.rb', line 353

def ping_scanner_with_http_info(settings, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScannerApi.ping_scanner ...'
  end
  # verify the required parameter 'settings' is set
  if @api_client.config.client_side_validation && settings.nil?
    fail ArgumentError, "Missing the required parameter 'settings' when calling ScannerApi.ping_scanner"
  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 ScannerApi.ping_scanner, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/scanners/ping'

  # 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?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(settings)
  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: ScannerApi#ping_scanner\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_scanner_as_default(registration_id, payload, opts = {}) ⇒ nil

Set system default scanner registration Set the specified scanner registration as the system default one.

Parameters:

  • registration_id

    The scanner registration identifier.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


403
404
405
406
# File 'lib/harbor2_client/api/scanner_api.rb', line 403

def set_scanner_as_default(registration_id, payload, opts = {})
  set_scanner_as_default_with_http_info(registration_id, payload, opts)
  nil
end

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

Set system default scanner registration Set the specified scanner registration as the system default one.

Parameters:

  • registration_id

    The scanner registration identifier.

  • payload
  • 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



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
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
# File 'lib/harbor2_client/api/scanner_api.rb', line 415

def set_scanner_as_default_with_http_info(registration_id, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScannerApi.set_scanner_as_default ...'
  end
  # verify the required parameter 'registration_id' is set
  if @api_client.config.client_side_validation && registration_id.nil?
    fail ArgumentError, "Missing the required parameter 'registration_id' when calling ScannerApi.set_scanner_as_default"
  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 ScannerApi.set_scanner_as_default"
  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 ScannerApi.set_scanner_as_default, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/scanners/{registration_id}'.sub('{' + 'registration_id' + '}', registration_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?

  # 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(:PATCH, 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: ScannerApi#set_scanner_as_default\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_scanner(registration_id, registration, opts = {}) ⇒ nil

Update a scanner registration Updates the specified scanner registration.

Parameters:

  • registration_id

    The scanner registration identifier.

  • registration

    A scanner registraiton to be updated.

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

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

Returns:

  • (nil)


469
470
471
472
# File 'lib/harbor2_client/api/scanner_api.rb', line 469

def update_scanner(registration_id, registration, opts = {})
  update_scanner_with_http_info(registration_id, registration, opts)
  nil
end

#update_scanner_with_http_info(registration_id, registration, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update a scanner registration Updates the specified scanner registration.

Parameters:

  • registration_id

    The scanner registration identifier.

  • registration

    A scanner registraiton to be updated.

  • 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



481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
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
# File 'lib/harbor2_client/api/scanner_api.rb', line 481

def update_scanner_with_http_info(registration_id, registration, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScannerApi.update_scanner ...'
  end
  # verify the required parameter 'registration_id' is set
  if @api_client.config.client_side_validation && registration_id.nil?
    fail ArgumentError, "Missing the required parameter 'registration_id' when calling ScannerApi.update_scanner"
  end
  # verify the required parameter 'registration' is set
  if @api_client.config.client_side_validation && registration.nil?
    fail ArgumentError, "Missing the required parameter 'registration' when calling ScannerApi.update_scanner"
  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 ScannerApi.update_scanner, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/scanners/{registration_id}'.sub('{' + 'registration_id' + '}', registration_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?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(registration)
  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: ScannerApi#update_scanner\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end