Class: Hostinterfaces

Inherits:
Basic
  • Object
show all
Defined in:
lib/zapix/proxies/hostinterfaces.rb

Instance Method Summary collapse

Methods inherited from Basic

#initialize

Constructor Details

This class inherits a constructor from Basic

Instance Method Details

#create(options) ⇒ Object



5
6
7
# File 'lib/zapix/proxies/hostinterfaces.rb', line 5

def create(options)
  @client.hostinterface_create(options) unless exists?(options)
end

#exists?(options) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
# File 'lib/zapix/proxies/hostinterfaces.rb', line 9

def exists?(options)
  if get(options).empty?
    false
  else
    true
  end
end

#get(options) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/zapix/proxies/hostinterfaces.rb', line 17

def get(options)
  @client.hostinterface_get(
    {'filter' => {'hostid' => options['hostid'],
    'port' => options['port'],
    'type' => options['type']},
    'output' => 'extend'})
end