class Nessus6::Folder

The Folders class is for interacting with Nessus6 folders. Folders are used to sort and organize a user's scan results. localhost:8834/api#/resources/folders

Public Class Methods

new(client) click to toggle source
# File lib/Nessus6/folder.rb, line 11
def initialize(client)
  @client = client
end

Public Instance Methods

create(name) click to toggle source

Creates a new folder for the current user. This request requires read-only user permissions.

@param name [String] The name of the folder. @return [Hash]

# File lib/Nessus6/folder.rb, line 20
def create(name)
  response = @client.post('folders', name: name)
  verify response,
         bad_request: 'Folder name is invalid',
         forbidden: 'You do not have permission to create a folder.',
         internal_server_error: 'Server failed to create the folder.'
end
delete(folder_id) click to toggle source

Deletes a folder. This request requires read-only user permissions.

@param folder_id [String, Fixnum] The id of the folder to delete. @return [Hash]

# File lib/Nessus6/folder.rb, line 32
def delete(folder_id)
  response = @client.delete("folders/#{folder_id}")
  verify response,
         forbidden: 'Cannot delete a system folder.',
         not_found: 'Folder does not exist.',
         internal_server_error: 'Server failed to delete the folder.'
end
edit(folder_id, name) click to toggle source

Rename a folder for the current user. This request requires read-only user permissions.

@param folder_id [String, Fixnum] The id of the folder to edit. @param name [String] The name of the folder. @return [Hash]

# File lib/Nessus6/folder.rb, line 46
def edit(folder_id, name)
  response = @client.put("folders/#{folder_id}", name: name)
  verify response,
         forbidden: 'Cannot rename a system folder.',
         not_found: 'Folder does not exist.',
         internal_server_error: 'Server failed to rename the folder.'
end
Also aliased as: rename
list() click to toggle source

Returns the current user's scan folders.

@return [Hash] { “folders”: [folder Resource] }

# File lib/Nessus6/folder.rb, line 59
def list
  response = @client.get('folders')
  verify response,
         forbidden: 'You do not have permission to view the folder list.',
         internal_server_error: 'An internal server error occurred.'
end
rename(folder_id, name)
Alias for: edit