class Templates
Public Instance Methods
create(options)
click to toggle source
# File lib/zapix/proxies/templates.rb, line 12 def create(options) client.template_create(options) unless exists?(options['host']) end
exists?(name)
click to toggle source
# File lib/zapix/proxies/templates.rb, line 3 def exists?(name) result = client.template_get('filter' => { 'name' => name }) if result.nil? || result.empty? false else true end end
get_id(name)
click to toggle source
# File lib/zapix/proxies/templates.rb, line 16 def get_id(name) if exists?(name) client.template_get('filter' => { 'name' => name }).first['templateid'] else raise NonExistingTemplate, "Template #{name} does not exist !" end end
get_templates_for_host(id)
click to toggle source
# File lib/zapix/proxies/templates.rb, line 24 def get_templates_for_host(id) client.template_get('hostids' => [id]).map { |result_set| result_set['templateid'] } end