Class: Infoblox::Network

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

Instance Attribute Summary

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_reader, remote_attr_writer, #remote_attribute_hash, remote_attrs, remote_post_accessor, remote_post_attrs, remote_read_only_attrs, remote_write_only_attrs, resource_map, resource_uri, #resource_uri, wapi_object

Constructor Details

This class inherits a constructor from Infoblox::Resource

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).



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

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