Class: Infoblox::Range
- Defined in:
- lib/infoblox/resource/range.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#next_available_ip(num = 1, exclude = []) ⇒ Object
Invoke the same-named function on the range resource in WAPI, returning an array of available IP addresses.
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 range 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).
17 18 19 20 21 22 23 |
# File 'lib/infoblox/resource/range.rb', line 17 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 |