class CpMgmt::Host
Public Instance Methods
add(name, ip_address, options={})
click to toggle source
Adds a host
# File lib/cp_mgmt/host.rb, line 4 def add(name, ip_address, options={}) client = CpMgmt.configuration.client CpMgmt.logged_in? params = {name: name, "ip-address": ip_address} body = params.merge(options).to_json response = client.post do |req| req.url '/web_api/add-host' req.headers['Content-Type'] = 'application/json' req.headers['X-chkp-sid'] = ENV.fetch("sid") req.body = body end CpMgmt.transform_response(response) end
remove(name)
click to toggle source
removes a host
# File lib/cp_mgmt/host.rb, line 20 def remove(name) client = CpMgmt.configuration.client CpMgmt.logged_in? body = {name: name}.to_json response = client.post do |req| req.url '/web_api/delete-host' req.headers['Content-Type'] = 'application/json' req.headers['X-chkp-sid'] = ENV.fetch("sid") req.body = body end CpMgmt.transform_response(response) end
show(name)
click to toggle source
Shows a host
# File lib/cp_mgmt/host.rb, line 35 def show(name) client = CpMgmt.configuration.client CpMgmt.logged_in? body = {name: name}.to_json response = client.post do |req| req.url '/web_api/show-host' req.headers['Content-Type'] = 'application/json' req.headers['X-chkp-sid'] = ENV.fetch("sid") req.body = body end CpMgmt.transform_response(response) end
show_all()
click to toggle source
Shows all hosts
# File lib/cp_mgmt/host.rb, line 50 def show_all client = CpMgmt.configuration.client CpMgmt.logged_in? response = client.post do |req| req.url '/web_api/show-hosts' req.headers['Content-Type'] = 'application/json' req.headers['X-chkp-sid'] = ENV.fetch("sid") req.body = "{}" end CpMgmt.transform_response(response) end