Class: Infoblox::Host
- Defined in:
- lib/infoblox/resource/host.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#add_ipv4addr(address) ⇒ Object
Add an IP address to this host.
- #ipv4addrs ⇒ Object
-
#ipv4addrs=(attrs = []) ⇒ Object
The more robust way to add IP addresses to your host record, allowing you to set all the attributes.
- #remote_attribute_hash(write = false, post = false) ⇒ Object
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_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 Method Details
#add_ipv4addr(address) ⇒ Object
Add an IP address to this host. Only allows setting the ipv4addr field of the remote HostIpv4Addr record. If you need to set other fields, such as mac or configure_for_dns, use #ipv4addrs=
35 36 37 |
# File 'lib/infoblox/resource/host.rb', line 35 def add_ipv4addr(address) ipv4addrs << HostIpv4addr.new(:ipv4addr => address) end |
#ipv4addrs ⇒ Object
39 40 41 |
# File 'lib/infoblox/resource/host.rb', line 39 def ipv4addrs @ipv4addrs ||= [] end |
#ipv4addrs=(attrs = []) ⇒ Object
The more robust way to add IP addresses to your host record, allowing you to set all the attributes.
Example:
host.ipv4addrs=[{:ipv4addr => '10.10.10.10', :mac => '0x0x0x0x0x0x0x'}]
24 25 26 27 28 |
# File 'lib/infoblox/resource/host.rb', line 24 def ipv4addrs=(attrs=[]) attrs.each do |att| ipv4addrs << HostIpv4addr.new(att) end end |
#remote_attribute_hash(write = false, post = false) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/infoblox/resource/host.rb', line 43 def remote_attribute_hash(write=false, post=false) super.tap do |hsh| hsh[:ipv4addrs] = ipv4addrs.map do |i| i.remote_attribute_hash(write, post).delete_if{|k,v| v.nil? } end end end |