Class: Infoblox::Network

Inherits:
Resource show all
Defined in:
lib/infoblox/resource/network.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#_ref, #connection

Instance Method Summary collapse

Methods inherited from Resource

_return_fields, all, default_params, #delete, find, #get, #initialize, #post, #put, remote_attr_accessor, remote_attr_writer, #remote_attribute_hash, remote_attrs, remote_post_accessor, remote_post_attrs, remote_write_only_attrs, resource_map, resource_uri, #resource_uri, wapi_object

Constructor Details

This class inherits a constructor from Infoblox::Resource

Instance Attribute Details

#network_containerObject

Returns the value of attribute network_container.



9
10
11
# File 'lib/infoblox/resource/network.rb', line 9

def network_container
  @network_container
end

#network_viewObject

Returns the value of attribute network_view.



9
10
11
# File 'lib/infoblox/resource/network.rb', line 9

def network_view
  @network_view
end

Instance Method Details

#next_available_ip(num = 1, exclude = []) ⇒ Object

Invoke the same-named function on the network resource in WAPI, returning an array of available IP addresses. You may optionally specify how many IPs you want (num) and which ones to exclude from consideration (array of IPv4 address strings).



19
20
21
22
23
24
25
# File 'lib/infoblox/resource/network.rb', line 19

def next_available_ip(num=1, exclude=[])
  post_body = {
    num:     num.to_i,
    exclude: exclude
  }
  JSON.parse(connection.post(resource_uri + "?_function=next_available_ip", post_body).body)["ips"]
end