Class: SwaggerClient::ScanApi

Inherits:
Object
  • Object
show all
Defined in:
lib/service/api/rapid7_insightvm_client/lib/swagger_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.



16
17
18
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#get_scan(site_idte_id, opts = {}) ⇒ Scan

Scan Returns the specified scan.

Parameters:

  • id

    The identifier of the scan.

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

    the optional parameters

Returns:



24
25
26
27
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 24

def get_scan(site_idte_id, opts = {})
  data, _status_code, _headers = get_scan_with_http_info(site_idte_id, opts)
  data
end

#get_scan_with_http_info(site_idte_id, opts = {}) ⇒ Array<(Scan, Integer, Hash)>

Scan Returns the specified scan.

Parameters:

  • id

    The identifier of the scan.

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

    the optional parameters

Returns:

  • (Array<(Scan, Integer, Hash)>)

    Scan data, response status code and response headers



34
35
36
37
38
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
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 34

def get_scan_with_http_info(site_idte_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.get_scan ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && site_idte_id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ScanApi.get_scan"
  end
  # resource path
  local_var_path = '/api/3/scans/{id}'.sub('{' + 'id' + '}', site_idte_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Scan' 

  auth_names = opts[:auth_names] || []
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#get_scan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_scans(opts = {}) ⇒ PageOfGlobalScan

Scans Returns all scans.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :active (BOOLEAN)

    Return running scans or past scans (true/false value). (default to false)

  • :page (Integer)

    The index of the page (zero-based) to retrieve. (default to 0)

  • :size (Integer)

    The number of records per page to retrieve. (default to 10)

  • :sort (Array<String>)

    The criteria to sort the records by, in the format: &#x60;property&#x60;. The default sort order is ascending. Multiple sort criteria can be specified using multiple sort query parameters.

Returns:



83
84
85
86
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 83

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

#get_scans_with_http_info(opts = {}) ⇒ Array<(PageOfGlobalScan, Integer, Hash)>

Scans Returns all scans.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :active (BOOLEAN)

    Return running scans or past scans (true/false value).

  • :page (Integer)

    The index of the page (zero-based) to retrieve.

  • :size (Integer)

    The number of records per page to retrieve.

  • :sort (Array<String>)

    The criteria to sort the records by, in the format: &#x60;property&#x60;. The default sort order is ascending. Multiple sort criteria can be specified using multiple sort query parameters.

Returns:

  • (Array<(PageOfGlobalScan, Integer, Hash)>)

    PageOfGlobalScan data, response status code and response headers



96
97
98
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
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 96

def get_scans_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.get_scans ...'
  end
  # resource path
  local_var_path = '/api/3/scans'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'active'] = opts[:'active'] if !opts[:'active'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
  query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'PageOfGlobalScan' 

  auth_names = opts[:auth_names] || []
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#get_scans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_site_scans(site_idte_id, opts = {}) ⇒ PageOfScan

Site Scans Returns the scans for the specified site.

Parameters:

  • id

    The identifier of the site.

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

    the optional parameters

Options Hash (opts):

  • :active (BOOLEAN)

    Return running scans or past scans (true/false value). (default to false)

  • :page (Integer)

    The index of the page (zero-based) to retrieve. (default to 0)

  • :size (Integer)

    The number of records per page to retrieve. (default to 10)

  • :sort (Array<String>)

    The criteria to sort the records by, in the format: &#x60;property&#x60;. The default sort order is ascending. Multiple sort criteria can be specified using multiple sort query parameters.

Returns:



146
147
148
149
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 146

def get_site_scans(site_idte_id, opts = {})
  data, _status_code, _headers = get_site_scans_with_http_info(site_idte_id, opts)
  data
end

#get_site_scans_with_http_info(site_idte_id, opts = {}) ⇒ Array<(PageOfScan, Integer, Hash)>

Site Scans Returns the scans for the specified site.

Parameters:

  • id

    The identifier of the site.

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

    the optional parameters

Options Hash (opts):

  • :active (BOOLEAN)

    Return running scans or past scans (true/false value).

  • :page (Integer)

    The index of the page (zero-based) to retrieve.

  • :size (Integer)

    The number of records per page to retrieve.

  • :sort (Array<String>)

    The criteria to sort the records by, in the format: &#x60;property&#x60;. The default sort order is ascending. Multiple sort criteria can be specified using multiple sort query parameters.

Returns:

  • (Array<(PageOfScan, Integer, Hash)>)

    PageOfScan 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
204
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 160

def get_site_scans_with_http_info(site_idte_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.get_site_scans ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && site_idte_id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ScanApi.get_site_scans"
  end
  # resource path
  local_var_path = '/api/3/sites/{id}/scans'.sub('{' + 'id' + '}', site_idte_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'active'] = opts[:'active'] if !opts[:'active'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
  query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'PageOfScan' 

  auth_names = opts[:auth_names] || []
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#get_site_scans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_scan_status(site_idte_id, status, opts = {}) ⇒ Links

Scan Status Updates the scan status. Can pause, resume, and stop scans using this resource. In order to stop a scan the scan must be running or paused. In order to resume a scan the scan must be paused. In order to pause a scan the scan must be running.

Parameters:

  • id

    The identifier of the scan.

  • status

    The status of the scan.

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

    the optional parameters

Returns:



211
212
213
214
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 211

def set_scan_status(site_idte_id, status, opts = {})
  data, _status_code, _headers = set_scan_status_with_http_info(site_idte_id, status, opts)
  data
end

#set_scan_status_with_http_info(site_idte_id, status, opts = {}) ⇒ Array<(Links, Integer, Hash)>

Scan Status Updates the scan status. Can pause, resume, and stop scans using this resource. In order to stop a scan the scan must be running or paused. In order to resume a scan the scan must be paused. In order to pause a scan the scan must be running.

Parameters:

  • id

    The identifier of the scan.

  • status

    The status of the scan.

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

    the optional parameters

Returns:

  • (Array<(Links, Integer, Hash)>)

    Links data, response status code and response headers



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
265
266
267
268
269
270
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 222

def set_scan_status_with_http_info(site_idte_id, status, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.set_scan_status ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && site_idte_id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ScanApi.set_scan_status"
  end
  # verify the required parameter 'status' is set
  if @api_client.config.client_side_validation && status.nil?
    fail ArgumentError, "Missing the required parameter 'status' when calling ScanApi.set_scan_status"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['pause', 'stop', 'resume'].include?(status)
    fail ArgumentError, "invalid value for 'status', must be one of pause, stop, resume"
  end
  # resource path
  local_var_path = '/api/3/scans/{id}/{status}'.sub('{' + 'id' + '}', site_idte_id.to_s).sub('{' + 'status' + '}', status.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Links' 

  auth_names = opts[:auth_names] || []
  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,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#set_scan_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#start_scan(site_idte_id, opts = {}) ⇒ CreatedReferenceScanIDLink

Site Scans Starts a scan for the specified site.

Parameters:

  • id

    The identifier of the site.

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

    the optional parameters

Options Hash (opts):

  • :body (AdhocScan)

    The details for the scan.

  • :override_blackout (BOOLEAN)

    Whether to request for the override of an scan blackout window. (default to false)

Returns:



278
279
280
281
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 278

def start_scan(site_idte_id, opts = {})
  data, _status_code, _headers = start_scan_with_http_info(site_idte_id, opts)
  data
end

#start_scan_with_http_info(site_idte_id, opts = {}) ⇒ Array<(CreatedReferenceScanIDLink, Integer, Hash)>

Site Scans Starts a scan for the specified site.

Parameters:

  • id

    The identifier of the site.

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

    the optional parameters

Options Hash (opts):

  • :body (AdhocScan)

    The details for the scan.

  • :override_blackout (BOOLEAN)

    Whether to request for the override of an scan blackout window.

Returns:

  • (Array<(CreatedReferenceScanIDLink, Integer, Hash)>)

    CreatedReferenceScanIDLink data, response status code and response headers



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
# File 'lib/service/api/rapid7_insightvm_client/lib/swagger_client/api/scan_api.rb', line 290

def start_scan_with_http_info(site_idte_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScanApi.start_scan ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && site_idte_id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ScanApi.start_scan"
  end
  # resource path
  local_var_path = '/api/3/sites/{id}/scans'.sub('{' + 'id' + '}', site_idte_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'overrideBlackout'] = opts[:'override_blackout'] if !opts[:'override_blackout'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) 

  return_type = opts[:return_type] || 'CreatedReferenceScanIDLink' 

  auth_names = opts[:auth_names] || []
  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,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#start_scan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end