Class: Harbor1Client::ScanApi

Inherits:
Object
  • Object
show all
Defined in:
lib/harbor1_client/api/scan_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ScanApi

Returns a new instance of ScanApi.



19
20
21
# File 'lib/harbor1_client/api/scan_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/harbor1_client/api/scan_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#repositories_repo_name_tags_tag_scan_get(repo_name, tag, opts = {}) ⇒ Report

Get the scan report Retrieve the scan report for the artifact identified by the repo_name and tag.

Parameters:

  • repo_name

    Repository name

  • tag

    Tag name

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

    the optional parameters

Options Hash (opts):

  • :accept (String)

    Mimetype in header. e.g: "application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0"

Returns:



29
30
31
32
# File 'lib/harbor1_client/api/scan_api.rb', line 29

def repositories_repo_name_tags_tag_scan_get(repo_name, tag, opts = {})
  data, _status_code, _headers = repositories_repo_name_tags_tag_scan_get_with_http_info(repo_name, tag, opts)
  data
end

#repositories_repo_name_tags_tag_scan_get_with_http_info(repo_name, tag, opts = {}) ⇒ Array<(Report, Fixnum, Hash)>

Get the scan report Retrieve the scan report for the artifact identified by the repo_name and tag.

Parameters:

  • repo_name

    Repository name

  • tag

    Tag name

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

    the optional parameters

Options Hash (opts):

  • :accept (String)

    Mimetype in header. e.g: &quot;application/vnd.scanner.adapter.vuln.report.harbor+json; version&#x3D;1.0&quot;

Returns:

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

    Report data, 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/harbor1_client/api/scan_api.rb', line 41

def repositories_repo_name_tags_tag_scan_get_with_http_info(repo_name, tag, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.repositories_repo_name_tags_tag_scan_get ...'
  end
  # verify the required parameter 'repo_name' is set
  if @api_client.config.client_side_validation && repo_name.nil?
    fail ArgumentError, "Missing the required parameter 'repo_name' when calling ScanApi.repositories_repo_name_tags_tag_scan_get"
  end
  # verify the required parameter 'tag' is set
  if @api_client.config.client_side_validation && tag.nil?
    fail ArgumentError, "Missing the required parameter 'tag' when calling ScanApi.repositories_repo_name_tags_tag_scan_get"
  end
  # resource path
  local_var_path = '/repositories/{repo_name}/tags/{tag}/scan'.sub('{' + 'repo_name' + '}', repo_name.to_s).sub('{' + 'tag' + '}', tag.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', 'text/plain'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'Accept'] = opts[:'accept'] if !opts[:'accept'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  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 => 'Report')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#repositories_repo_name_tags_tag_scan_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#repositories_repo_name_tags_tag_scan_post(repo_name, tag, opts = {}) ⇒ nil

Scan the image. Trigger a scan targeting the artifact identified by the repo_name and tag.

Parameters:

  • repo_name

    Repository name

  • tag

    Tag name

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

    the optional parameters

Returns:

  • (nil)


91
92
93
94
# File 'lib/harbor1_client/api/scan_api.rb', line 91

def repositories_repo_name_tags_tag_scan_post(repo_name, tag, opts = {})
  repositories_repo_name_tags_tag_scan_post_with_http_info(repo_name, tag, opts)
  nil
end

#repositories_repo_name_tags_tag_scan_post_with_http_info(repo_name, tag, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Scan the image. Trigger a scan targeting the artifact identified by the repo_name and tag.

Parameters:

  • repo_name

    Repository name

  • tag

    Tag name

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
143
# File 'lib/harbor1_client/api/scan_api.rb', line 102

def repositories_repo_name_tags_tag_scan_post_with_http_info(repo_name, tag, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.repositories_repo_name_tags_tag_scan_post ...'
  end
  # verify the required parameter 'repo_name' is set
  if @api_client.config.client_side_validation && repo_name.nil?
    fail ArgumentError, "Missing the required parameter 'repo_name' when calling ScanApi.repositories_repo_name_tags_tag_scan_post"
  end
  # verify the required parameter 'tag' is set
  if @api_client.config.client_side_validation && tag.nil?
    fail ArgumentError, "Missing the required parameter 'tag' when calling ScanApi.repositories_repo_name_tags_tag_scan_post"
  end
  # resource path
  local_var_path = '/repositories/{repo_name}/tags/{tag}/scan'.sub('{' + 'repo_name' + '}', repo_name.to_s).sub('{' + 'tag' + '}', tag.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', 'text/plain'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  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: ScanApi#repositories_repo_name_tags_tag_scan_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#repositories_repo_name_tags_tag_scan_uuid_log_get(repo_name, tag, uuid, opts = {}) ⇒ String

Get scan log Get the log text stream for the given artifact and scan action.

Parameters:

  • repo_name

    Repository name

  • tag

    Tag name

  • uuid

    the scan unique identifier

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

    the optional parameters

Returns:

  • (String)


151
152
153
154
# File 'lib/harbor1_client/api/scan_api.rb', line 151

def repositories_repo_name_tags_tag_scan_uuid_log_get(repo_name, tag, uuid, opts = {})
  data, _status_code, _headers = repositories_repo_name_tags_tag_scan_uuid_log_get_with_http_info(repo_name, tag, uuid, opts)
  data
end

#repositories_repo_name_tags_tag_scan_uuid_log_get_with_http_info(repo_name, tag, uuid, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Get scan log Get the log text stream for the given artifact and scan action.

Parameters:

  • repo_name

    Repository name

  • tag

    Tag name

  • uuid

    the scan unique identifier

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



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
204
205
206
207
208
209
# File 'lib/harbor1_client/api/scan_api.rb', line 163

def repositories_repo_name_tags_tag_scan_uuid_log_get_with_http_info(repo_name, tag, uuid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.repositories_repo_name_tags_tag_scan_uuid_log_get ...'
  end
  # verify the required parameter 'repo_name' is set
  if @api_client.config.client_side_validation && repo_name.nil?
    fail ArgumentError, "Missing the required parameter 'repo_name' when calling ScanApi.repositories_repo_name_tags_tag_scan_uuid_log_get"
  end
  # verify the required parameter 'tag' is set
  if @api_client.config.client_side_validation && tag.nil?
    fail ArgumentError, "Missing the required parameter 'tag' when calling ScanApi.repositories_repo_name_tags_tag_scan_uuid_log_get"
  end
  # verify the required parameter 'uuid' is set
  if @api_client.config.client_side_validation && uuid.nil?
    fail ArgumentError, "Missing the required parameter 'uuid' when calling ScanApi.repositories_repo_name_tags_tag_scan_uuid_log_get"
  end
  # resource path
  local_var_path = '/repositories/{repo_name}/tags/{tag}/scan/{uuid}/log'.sub('{' + 'repo_name' + '}', repo_name.to_s).sub('{' + 'tag' + '}', tag.to_s).sub('{' + 'uuid' + '}', uuid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  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 => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#repositories_repo_name_tags_tag_scan_uuid_log_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#scans_all_metrics_get(opts = {}) ⇒ Stats

Get the metrics of the latest scan all process Get the metrics of the latest scan all process

Parameters:

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

    the optional parameters

Returns:



214
215
216
217
# File 'lib/harbor1_client/api/scan_api.rb', line 214

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

#scans_all_metrics_get_with_http_info(opts = {}) ⇒ Array<(Stats, Fixnum, Hash)>

Get the metrics of the latest scan all process Get the metrics of the latest scan all process

Parameters:

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

    the optional parameters

Returns:

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

    Stats data, response status code and response headers



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
# File 'lib/harbor1_client/api/scan_api.rb', line 223

def scans_all_metrics_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.scans_all_metrics_get ...'
  end
  # resource path
  local_var_path = '/scans/all/metrics'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/plain'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  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 => 'Stats')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#scans_all_metrics_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#scans_schedule_metrics_get(opts = {}) ⇒ Stats

Get the metrics of the latest scheduled scan all process Get the metrics of the latest scheduled scan all process

Parameters:

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

    the optional parameters

Returns:



262
263
264
265
# File 'lib/harbor1_client/api/scan_api.rb', line 262

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

#scans_schedule_metrics_get_with_http_info(opts = {}) ⇒ Array<(Stats, Fixnum, Hash)>

Get the metrics of the latest scheduled scan all process Get the metrics of the latest scheduled scan all process

Parameters:

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

    the optional parameters

Returns:

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

    Stats data, response status code and response headers



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/harbor1_client/api/scan_api.rb', line 271

def scans_schedule_metrics_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.scans_schedule_metrics_get ...'
  end
  # resource path
  local_var_path = '/scans/schedule/metrics'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/plain'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  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 => 'Stats')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#scans_schedule_metrics_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end