Module: RemoteServiceDataService

Included in:
DataServiceAutoLoader
Defined in:
lib/metasploit/framework/data_service/remote/http/remote_service_data_service.rb

Constant Summary collapse

SERVICE_API_PATH =
'/api/v1/services'
SERVICE_MDM_CLASS =
'Mdm::Service'

Instance Method Summary collapse

Instance Method Details

#delete_service(opts) ⇒ Object



23
24
25
# File 'lib/metasploit/framework/data_service/remote/http/remote_service_data_service.rb', line 23

def delete_service(opts)
  json_to_mdm_object(self.delete_data(SERVICE_API_PATH, opts), SERVICE_MDM_CLASS)
end

#report_service(opts) ⇒ Object



10
11
12
# File 'lib/metasploit/framework/data_service/remote/http/remote_service_data_service.rb', line 10

def report_service(opts)
  json_to_mdm_object(self.post_data(SERVICE_API_PATH, opts), SERVICE_MDM_CLASS).first
end

#services(opts) ⇒ Object



5
6
7
8
# File 'lib/metasploit/framework/data_service/remote/http/remote_service_data_service.rb', line 5

def services(opts)
  path = get_path_select(opts, SERVICE_API_PATH)
  json_to_mdm_object(self.get_data(path, nil, opts), SERVICE_MDM_CLASS)
end

#update_service(opts) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/metasploit/framework/data_service/remote/http/remote_service_data_service.rb', line 14

def update_service(opts)
  path = SERVICE_API_PATH
  if opts && opts[:id]
    id = opts.delete(:id)
    path = "#{SERVICE_API_PATH}/#{id}"
  end
  json_to_mdm_object(self.put_data(path, opts), SERVICE_MDM_CLASS)
end